A possibly better solution would be an OS switch, and including SIGABRT (to avoid the console window crashing on closing) - up from line 73:

def handle_signals():

def signal_handler(signum, frame):
quit()

if os.name == 'posix':
signals = (signal.SIGINT, signal.SIGTERM, signal.SIGHUP)
## Above for Unix. Below for Windows
elif os.name == 'nt':
signals = (signal.SIGINT, signal.SIGTERM, signal.SIGABRT)

for sig in signals:
signal.signal(sig, signal_handler)