[Idle-dev] Interruptable code?
Douglas S. Blank
dblank at brynmawr.edu
Sat Dec 16 15:31:22 CET 2006
On Sat, December 16, 2006 3:21 am, Kurt B. Kaiser said:
> def func():
> while True:
> if flist.pyshell.canceled:
> while True: func()
> (works w/o subprocess)
Thanks! That will do it.
>> - 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
>>> 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 "problem" has caused John Zelle to have to add code to his
graphics.py so that Tkinter will work the same in both methods of running
and look at graphics.py.
Is there an option I'm not aware of? (BTW, I do what a solution to work on
Windows, Mac, and Linux).
> One of the objectives for implementing the subprocess was to separate
> the IDLE GUI from the user code. The user code can be interrupted even
> while True: pass
> (But IDLE Windows has problems with killing user code which is blocked.)
Douglas S. Blank
Associate Professor, Bryn Mawr College
Office: 610 526 601
More information about the IDLE-dev