[Edu-sig] question about livewires package. . .

John Zelle john.zelle at wartburg.edu
Mon Nov 21 15:48:49 CET 2005



Scott David Daniels wrote:
> Kirby Urner wrote:
> 
> 
>>Speculation on my part.  On target?
> 
> 
> Sounds right, but I really haven't investigated beyond learning how to
> get back to the point where I can experiment with TkInter interactively.
> There is so much more learning possible with the immediate feedback,
> that it is worth (to me) the increased fragility and irreproducibility.
> 
> When using idle in "normal" (separate process) mode, I leave one idle
> session open for a week at a time (shutting down w/ standby).  With "-n"
> I wind up restarting Idle every couple of hours for one reason or
> another.  The big place this hurts is when my software goes insane, and
> I can no longer cut and paste before restarting (in fact I lose all
> display capability for the windows).  So I have to try to remember what
> broke things.  As a result, I have two shortcuts on my desktop: one for
> "normal" Idle, and one for "in-process" ("-n") Idle.
> 
> VPython seems to have done OK with keeping interactivity, I really
> should look into how they do it.
>

VPython runs a GTK (I think) event loop in a separate thread, to stay 
interactive in IDLE. I have done something similar using TK in my 
graphics.py package, so it plays well interactively with IDLE (for the 
most part). Basically, the graphics package runs its own TK thread that 
executes the Tk event loop. All calls into the library are handed over 
to that thread for execution. The independent event loop keeps the 
graphics window responsive. The problem is that once you do this, your 
package is subject to the vargaries of the thread and subprocess models 
of the various platforms on which it runs. As a result, the threaded 
version of my package does not seem as rock-stable as the previous 
version had been. Tk seems a bit brittle in this respect, but it's 
really the only way to work with the new IDLE.  One side-effect of this 
approach is that when IDLE is run with -n, closing a graphics window 
shuts down IDLE. That's probably just a bug/misunderstanding on my part, 
but I haven't tracked it down yet.

-- 
John M. Zelle, Ph.D.             Wartburg College
Professor of Computer Science    Waverly, IA
john.zelle at wartburg.edu          (319) 352-8360


More information about the Edu-sig mailing list