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

Scott David Daniels Scott.Daniels at Acm.Org
Sun Nov 20 18:18:11 CET 2005


Andy Judkis wrote:
...
> Livewires graphics routines behave differently under Python 2.4.1 than they 
> do under 2.2.3.  Under 2.4.1, in IDLE, if I interactively run
>>>>from livewires import *
>>>>begin_graphics()
>>>>circle(100,100,50, filled=True)
>>>>circle(300,300,70)
>>>>end_graphics()
> then nothing shows up until I run end_graphics().  The circles then shows up 
> for moment, just before the graphics window is destroyed.
> If I run the same sequence under 2.2.3, the each circle shows up immediately 
> when the command is executed.  This latter behavior is what I want -- is 
> there a way to make it work that way under 2.4?
OK, here's what is going on.  In 2.3, an Idle rewrite happened to run
programs in a separate process, rather than keeping them in the same
process.  That meant, no matter how insane your program got, you could
simply "restart the shell" and discard the insane process.  This
unfortunately also meant the event loops weren't so connected, and
things like turtle graphics were nowhere near as fun (the event
processing for the graphics in interpreted environment needs to be
fed chances to draw).  Because of this loss of functionality,
you can start Idle with the "separate process" feature disabled by
changing the idle startup from something like: "python ...idle.pyw"
to something like "python ...idle.pyw -n" -- start idle with no
subprocesses.

on Windows:
     copy the idle shortcut (right-click, menu item copy; right-click on
     desktop, menu item paste).
     Right-click on your new shortcut (now often called something like
     "Copy of Idle") and choose properties. In the "General" tab, you
     can fix the name to be something more to your liking. On the
     shortcut tab, change the "Target" entry by append a space and a -n
     to the target.
     Click OK, and you have a new Idle button which does the one-process
     Idle thing.

I'm afraid I don't know the details for other systems, but the trick is
the same -- instead of simply running idle.pyw (or idle.py), add a
single "-n" argument to the process.

As is described elsewhere, this way of running Idle makes some things
nicer, but makes your idle program more fragile (no more so than the
2.2 idle, however).

If you launch the new IDLE, you'll get:

IDLE 1.1.2      ==== No Subprocess ====
  >>>


You can find more on this issue addressed in (for example):
     http://mail.python.org/pipermail/edu-sig/2004-April/003669.html

Hope this helps and is clear enough.  Happy instructing.

--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Edu-sig mailing list