<div><span class="gmail_quote">On 12/16/06, <b class="gmail_sendername">Douglas S. Blank</b> <<a href="mailto:dblank@brynmawr.edu">dblank@brynmawr.edu</a>> wrote:</span></div>
<div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>On Sat, December 16, 2006 3:21 am, Kurt B. Kaiser said:<br><br>>> - I can't use idle with sub processes (because I want to interact with
<br>>> Tkinter in a single thread)<br>><br>> If you run with the subprocess and construct Tkinter objects, they run in<br>> a process separate from the IDLE GUI. This is an advantage in most cases!<br><br>
Yes, I realize that. But there is one important case where it is not:<br>interactively creating and using Tkinter and/or the Python prompt. For<br>example, being able to create a window and interactively type in commands<br>
to alter the window. Maybe I am using Tkinter incorrectly from Idle? When<br>I type:<br><br>>>> import Tkinter<br>>>> tk = Tkinter.Tk()<br><br>in idle -n (or raw Python), I get to interactively manuipulate Tk windows.
<br>When run in idle with subprocesses, it doesn't show any windows until a<br>mainloop() (or similar method) is called.</blockquote>
<div> </div>
<div>
<div>This always works for me:</div>
<div> </div>
<div>import thread</div>
<div>import Tkinter</div>
<div>root = Tkinter.Tk()</div>
<div>...</div>
<div>thread.start_new_thread(root.mainloop, ())</div>
<div><br>This way you can even kill the mainloop without killing IDLE.</div>
<div> </div>
<div>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.</div></div></div>