Search code examples
pythontkinterterminatesys

How can I terminate Python Script with particular 'if' conditions that does not affect Tkinter GUI?


I have created GUI using Tkinter and one main script to run. I have some conditions in the main script. if conditions are not satisfied I want to terminate the further execution but keep the GUI active and open. Currently I am using sys.exit() to terminate the script but it is also affecting GUI and Gui goes in not responding mode right away.

for all false conditions in the main script, I am using error dialogue box(messagebox.showerror) on screen and I want to terminate the script once I click OK on the dialogue box.

Could anyone please help me get this working?

Thanks in advance.


Solution

  • i tried what furas said and it worked.

    "if you run some function then use return to end this function. – furas Jan 24 at 13:38"