Strange terminal behavior after quitting Tkinter application

Charles Sanders C.delete_this.Sanders at BoM.GOv.AU
Wed Apr 18 22:42:47 EDT 2007


Chris wrote:
> 
> But does anyone know why the Tkinter program is doing this to the
> terminal in the first place? I don't want to have to tell users of my
> program that they must recover their terminal's sanity each time after
> running my program.
> 

	I don't know about Tkinter, but my guess would be that
it has to change the terminal settings to do what it does, and
you are quitting without restoring the settings.

	Is there some Tkinter clean up that you have omitted ?

	Have you ensured that the clean up runs on both normal
exit and abnormal exit (eg ^C) ?

	For example, the curses library (in C) requires an
endwin() call before exit to restore settings. If this
is omitted, a "stty sane" is needed to set the terminal to
a semi-sensible default. On Unix and similar systems, signal
handlers are normally installed to ensure (as far as possible)
that the cleanup occurs if the process is killed. This also
applies to vi and similar programs that take total control of
the terminal.


Charles



More information about the Python-list mailing list