[Edu-sig] Tk from IDLE: How to 'Hello World'?
Thu, 28 Sep 2000 21:54:32 -0400
> Tk in Windows IDLE does not work the way tutorials suggest.
> As someone interested in using Python in schools, I think
> a GUI like IDLE is a potentially better learning environment
> than a command line in DOS or Xterm. I would like to see more
> bias in favor of using IDLE when doing work with Tk (IDLE
> being itself a Tk app, after all, and cross-platform).
"IDLE being itself a Tk app" is part of the problem. Without going into a
lot of detail: the commands you type into IDLE are executed in the same
process as IDLE itself, so you and IDLE share the same "instance" of Tk.
This causes a great number of problems, including the one you observe.
There may be workarounds for some of them.
The right way to solve this and various other problems is to execute your
code in a separate process. Guido and Jeremy planned to make IDLE work that
way but never got around to it. I modified the version of IDLE included in
VPython to do it, but only for scripts, not for interactive mode.
We preferred making it easy for students to write and execute short
anonymous scripts to emphasizing interactive mode. It is much easier to
correct mistakes in a script (since you can go back and edit it, and then
easily run it from the beginning).
If anyone wants to add remote execution in interactive mode to IDLE, I
suggest joining the idle-dev list and contributing to the IDLE fork at
http://sourceforge.net/projects/idlefork. That source tree includes my
changes, but I no longer have time to work on it.