dimanche 26 juillet 2020

Python Stopping a program at any point in an if command

I currently have a program that I am working on that requires the user to input some parameters, and then press a button to start the main part of the program.

After the start button is pressed, the if loop executes a sequential order of commands (around 20) and then stops.

I want to be able to stop this sequence of commands at any time during the code using a separate 'stop' button, but I am not sure how. I am more interested in a method of doing this than GUI syntax.

Any help is appreciated.

Example code:

if (start_button_is_pressed):
    #do thing a 
    #do thing b 
    #do thing c 
    ...
    #do thing z

# i want to be able to stop from any point a-z

Aucun commentaire:

Enregistrer un commentaire