Exiting a Program Running in Idle, Various Choices

W

W. eWatson

I I have a very simple program running in Python, with say the last
line print "bye". it finishes leaving the script showing >>> in the
shell window. The program proceeds linearly to the bottom line.

Suppose now I have instead a few lines of MatPlotLib code (MPL) like
this at the end:

....
Show()

Show displays some graph and again the code proceeds linearly from line
1. However, if one closes the graphic by clicking the x in the upper
right corner of that window, then no >>> appears in the shell, and one
must kill the shell using the x in the shell's upper right corner. A
little dialog with the choices of OK (kill) or cancel appears. Use OK
and the shell window disappears. A ctrl-c does nothing in the shell.

I know about sys.exit(),and a "finish" def when using Tkinter. I'm not
using Tkinter as far as I know via MPL.

So how does one exit smoothly in this case of Show(), so that the shell
window remains ready to entry commands?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top