closing an IDLE window from inside the script

352 views Asked by At

I have been looking around the internet and some stack overflow questions for a while now, but cannot figure this out. What I need is something that makes the IDLE shell window close. Here is what I have tried and failed with:

exit()
or
quit()

Both give me a prompt asking if I want to kill the program, which is stupid as I otherwise wouldnt use that command. If i select yes, the window closes as I want it to do but i need that to happen automaticly.

import sys
sys.exit()
or
raise SystemExit

Neither seem to be doing anything. No output and nothing happens.

import os
os._exit()

Does exit the script but instead of closing the window it restarts the shell inside.

let the main thread exit the script

Makes >>> appear and lets me use the console.

I need to be running the script in idle because of it letting me use the console for debugging. There is no way that I know of that makes it possible to access the python console if the script is running in the command line.

I am running the script on a raspberry pi 3 with raspbian jessie but I see the same behaviour on my windows 10 system.
using python 2.7.9

0

There are 0 answers