Suppose your code is in tktest.py
. Run it in from a command line with python tktest.py
. The GUI appears. Click Ende
and the command line prompt reappears.
Run it again with python -i tktest.py
. The -i
says "when the program stops, switch to interactive mode and give me a python '>>>' prompt so I can explore the state of the program". Click Ende
and a traceback for SystemExit
appears, followed by a >>>
prompt. The GUI is still present, and you can enter dir()
and other Python statements. Click Ende
again and this time python exits. The command line prompt reappears.
When you run your code from an IDLE editor with F5, it imitates running with -i
. A restart line and the GUI appear. When you click Ende
, >>>
appears. This is not 'nothing happens'. IDLE suppresses the SystemExit traceback. Hit Ende
and another >>>
prompt appears instead of IDLE exiting. This is all by design for user convenience.
Clicking the title bar [X] will close the gui. Another user already answered about a Close or Exit button.