Tkinter - Multiple Tk() instances/mainloops in one process?
Gregory Sheaffer
sheaffgr at gmail.com
Wed Mar 25 00:55:33 EDT 2009
I've been working on a Python project for several weeks involving a client
for connecting to an AIM distribution server and holding multiple
conversations in separate windows.
Without getting into a lot of detail, the basic main program loop is
while(1)
on message recieved
if new conversation
create a thread for a new window instance
if old conversation
route to that window for printing
The window instance is a Tkinter GUI class, on a basic level
self.root=Tk()
*stuff for root*
self.root.mainloop()
All the windows involved work fine when tested individually, and when run
the system handles a single conversation and that window fine (And another
after the first has been closed). However, if at any time we attempt to have
multiple windows (Which are in separate threads each with their own Tk()
call) the windows beyond the first fail to appear and tkinter seems to get
stuck in an infinite loop somewhere in the new mainloop() call.
So, basically, is this a problem inherent in using Tkinter? And if so, are
there any workarounds besides tying the windows to a root Tk() in the main
program (Which isn't really an option the way the system is currently
designed).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090325/a31e668a/attachment.html>
More information about the Python-list
mailing list