Tkinter and IDE's

Jeff Shannon jeff at ccvcorp.com
Mon Nov 19 20:42:42 EST 2001


Don Arnold wrote:

> I'm new to python and am interested in developing apps with Tkinter.
> However, every IDE I've come across for the Win32 platform experiences
> lockups/aborts when running Tkinter code. So far I've tried IDLE, PythonWin,
> and WING with little luck. Does anyone know of an IDE that successfully
> executes Tkinter code?

There are two problems with running Tkinter in most IDE's.  One is that Tk-based
apps share the same event queue, so that running a Tk app inside of another Tk
app will confuse things.  The other is that different GUI toolkits almost never
play well together, so running a Tk app inside of a different GUI kit's apps
will confuse things.

The full solution is to find an IDE that executes programs in a separate
process.  I couldn't tell you offhand which IDEs do this, but neither IDLE nor
PythonWin do, and it's fairly likely that you would need to use a commercial IDE
for this (though you may find one that's free for open-source development).

The workaround, is to have both an IDE *and* a shell window (dos prompt) open at
the same time.  Make changes to your app, save them, switch to the dos prompt,
and "python myscript.py", which you can do repeatedly by using up-arrow (you
will need to run doskey first on win95/98, but not on NT/2k).  This doesn't
allow much interactive debugging, but overall seems to work fairly well (you can
use print statements to send comments to the dos window).

Jeff Shannon
Technician/Programmer
Credit International





More information about the Python-list mailing list