On 12/16/06, Douglas S. Blank <[EMAIL PROTECTED]> wrote:
On Sat, December 16, 2006 3:21 am, Kurt B. Kaiser said: >> - I can't use idle with sub processes (because I want to interact with >> Tkinter in a single thread) > > If you run with the subprocess and construct Tkinter objects, they run in > a process separate from the IDLE GUI. This is an advantage in most cases! Yes, I realize that. But there is one important case where it is not: interactively creating and using Tkinter and/or the Python prompt. For example, being able to create a window and interactively type in commands to alter the window. Maybe I am using Tkinter incorrectly from Idle? When I type: >>> import Tkinter >>> tk = Tkinter.Tk() in idle -n (or raw Python), I get to interactively manuipulate Tk windows. When run in idle with subprocesses, it doesn't show any windows until a mainloop() (or similar method) is called.
This always works for me: import thread import Tkinter root = Tkinter.Tk() ... thread.start_new_thread(root.mainloop, ()) This way you can even kill the mainloop without killing IDLE. Hooking onto IDLE's GUI mainloop isn't a very good option IMO. It's very useful when you're debugging IDLE itself, but otherwise it's a source of inconsistent behavior and weird bugs.
_______________________________________________ IDLE-dev mailing list [email protected] http://mail.python.org/mailman/listinfo/idle-dev
