Trent Mick wrote:
Bob, some (hopefully helpful) advice from JeffH (Tcl/Tk dude) here.
Trent
--------------------------
Bob Kline wrote:
We have some code which binds events to a Tkinter widget. Works fine
on Linux, but fails using the ActiveState Python on Windows. Here's
the problem boiled down to the tiniest repro case I can produce:
#!/usr/bin/python
import tkFileDialog, Tkinter
def onKeyPress(event): print "event.char=%s" % event.char
root = Tkinter.Tk()
I would try a "root.update()" here.
print "directory = %s" % tkFileDialog.askdirectory()
root.bind('<KeyPress>', onKeyPress)
root.mainloop()
If the line which invokes tkFileDialog.askdirectory() is commented
out, then the events are caught. But when the line is left
uncommented, events are ignored when running ActiveState Python on
Windows (but not ignored when running on Linux). Makes no difference
whether events are bound to root or to some child widget. Is this a
known problem?
I *think* the problem may be that the native dialogs that are
used on Windows cause the Tcl event service to not initialize
correctly when called directly before the mainloop() like that.
I'm not entirely sure, because Tcl/Tk doesn't have the mainloop()
construct that Perl/Tk and Tkinter do, instead it always starts
the Tcl event loop from first Tk initialization.
Jeff
------------------------------------
Thanks, I was able to work around the problem with these helpful tips!
--
Bob Kline
http://www.rksystems.com
mailto:[EMAIL PROTECTED]
_______________________________________________
ActivePython mailing list
ActivePython@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython