Fw: [pygtk] Retrieving window Handler

John Ehresman jpe at wingware.com
Thu Dec 1 04:17:17 WST 2005


Nicholas wrote:
> I'm sorry John, but I didn't understand what you mean with
> win.window.handle... There is such a object like this on native python ?

The following code snippet creates a gtk.Invisible() window, realizes 
it, and then obtains its native handle:

 >>> import gtk
 >>> invisible = gtk.Invisible()
 >>> invisible.realize()
 >>> native_handle = invisible.window.handle

native_handle is what you hopefully can pass to the twain routines to 
get them to work.  The invisible window needs to exist for as long as 
the scanner is in use, probably for the length of the program's 
execution.  You'll need to have a main loop running in order for twain 
to work.

If you're new to pygtk, you may want to go through the tutorial and look 
at some examples to learn how pygtk works.

Cheers,

John


More information about the pygtk mailing list