Problems with Tkinter based scripts under emacs...

Brian Kelley bkelley at
Fri Feb 15 13:25:32 EST 2002

Rod Stephenson wrote:

> I'm having problems with emacs on win95 when running a python script
> that invokes Tkinter. I'm using the bash shell under emacs, and
> python-mode, so that I can start up an interpreter which appears in a
> comint buffer and issue commands. Theres no problem with regular
> python scripts, and its a nice environment for edit-run-debugging.
> I've just started using Tkinter and I find the following: The script
> runs fine, but when I quit the application, the shell just hangs and I
> don't get the >>> prompt back. I end up having to kill the process and
> restart the interpreter.
> Actually I'm not sure whether this is specifically an emacs issue. 

I think this is more likely a Windows issue.  Emacs also doesn't seem to 
like to run wxPython in shell mode either.  My guess is that on windows, 
the standard gui programs fiddle with the stdin/stdout and stderr pipes 
which gets emacs fairly confused.

This problem doesn't seem to occur on unix using the same toolkits and 

It's not free but the WING IDE seems to fix some of these problems under 
windows, take a look at the feature list here

> Everything works just fine in the DOS command line shell, but this is
> so annoying to use! Any hints about setting up emacs or idle to cope
> with Tkinter would be much appreciated.

The solution I use for debugging with Tkinter type ctrl-C ! in the 
source window to open up a shell and then type ctrl-C ctrl-C to run the 
source.  This allows print statements and exceptions to be viewable at 
run time.  The caveat is that the shell hangs when I leave Tk so the 
only benefit is the real time print statements.

Brian Kelley

More information about the Python-list mailing list