<div><span class="gmail_quote">On 12/16/06, <b class="gmail_sendername">Douglas S. Blank</b> &lt;<a href="mailto:dblank@brynmawr.edu">dblank@brynmawr.edu</a>&gt; 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>&gt;&gt; - I can't use idle with sub processes (because I want to interact with
<br>&gt;&gt; Tkinter in a single thread)<br>&gt;<br>&gt; If you run with the subprocess and construct Tkinter objects, they run in<br>&gt; a process separate from the IDLE GUI.&nbsp;&nbsp;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>&gt;&gt;&gt; import Tkinter<br>&gt;&gt;&gt; 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>&nbsp;</div>
<div>
<div>This always works for me:</div>
<div>&nbsp;</div>
<div>import thread</div>
<div>import Tkinter</div>
<div>root&nbsp;= Tkinter.Tk()</div>
<div>...</div>
<div>thread.start_new_thread(root.mainloop, ())</div>
<div><br>This way you can even kill the mainloop&nbsp;without killing IDLE.</div>
<div>&nbsp;</div>
<div>Hooking onto IDLE's&nbsp;GUI&nbsp;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&nbsp;inconsistent behavior and&nbsp;weird bugs.</div></div></div>