Googled a lot but every thing seam oversized for me.
I have a GUI (TKinter) programm that gernerates somthing, at the end the user can decide to press a stop button what results in sys.exit() or a Continue button what should start the srcipt a begin. The script is call on command lin by python3 script.py without any parameters
Appreciate any help
Can you clarify what the Continue button is supposed to do, and what problem you are having?
the Continue should start the programm from the beginning, All variables are reste in the code.
the Program ask vor some necessary values (in a GUI) and crea creates a .key and .crt.
The stop ends, the continue should start at the beginning to generate a new certificare. The certifucates are signed with a selfsigned CA
Will be good if all windows re killed.
You can try putting your script into a function, and then repeatedly call that function.
E.g.:
from tkinter import Tk, Button
def run_the_program():
w = Tk()
def script_action():
print("Hello, world!")
action_btn = Button(w, text="Do action", command=script_action)
b1 = Button(w, text="Stop")
b1.pack()
b2 = Button(w, text="Continue")
b2.pack()
should_exit = False
def stop():
nonlocal should_exit
should_exit = True
w.quit()
b1['command'] = stop
def continue():
w.quit()
b2['command'] = continue
w.mainloop()
w.destroy()
return should_exit
while True:
should_exit = run_the_program()
if should_exit:
break
Cool thank you I think I can implement this in my script.
Appreciate your help.
Regards
Rainer