Killing a Python program using ctrl C
Question: I have an assignment in school which i can't get around and i'm stuck with.

the assignment is to build a program that infinitly spews out random numbers
in a EasyGUI messagebox ( Yeah i know EasyGUI is old xD )

this is my source code:

import easygui

    
    
    while True:
        easygui.msgbox(random.randint(-100, 100))
    

The problem is that when i run this i can't get out of it. I should be allowed
to use ctrl+C but that doesn't work. Am i missing something?

Thank you in advance!


Answer: using signalhandlers does not seem to be a trivial task when it comes to
easygui, if you can work with quitting when `x` is pressed you can do the
following:

    
    
    while True:
        e = easygui.msgbox(random.randint(-100, 100))
        if e is None:
            break
    

`e` will either be a string `"OK"` if you press ok or None if `x` is pressed
so it is probably the simplest way to quit and end the loop.

