The term “lazy” only applies to intermediate operations and means that they only perform work when being requested by the terminal operation. Having a short-circuiting operation in the pipeline is a necessary, but not sufficient, condition for the processing of an infinite stream to terminate normally in finite time. A terminal operation is short-circuiting if, when presented with infinite input, it may terminate in finite time. An intermediate operation is short-circuiting if, when presented with infinite input, it may produce a finite stream as a result. Self.quitbutton = tk.The actual term you’re asking for is short-circuitingįurther, some operations are deemed short-circuiting operations. """a minimal example App containing only a QUIT button, that launches Tk.Button(self, text='Nooooo!', command=stroy).pack(side=tk.RIGHT, fill=tk.BOTH, padx=5, pady=5) Tk.Button(self, text='confirm', command=stroy, fg='red').pack(side=tk.RIGHT, fill=tk.BOTH, padx=5, pady=5) Tk.Label(self, text="Are you sure you want to quit").pack() If not, the popup closes and no further action is taken """A TopLevel popup that asks for confirmation that the user wants to quit. This PopUpConfirmQuit class can be reused as it is with other tkinter apps it only requires that the quit button of the main app launches it. Upon confirmation, the App is closed if not, the popup closes and the App remains active. Here is a minimal, reusable example where pressing the QUIT button on the main App, launches a popup window asking you to confirm. No_btn = Button(frame1, text="No", bg="light blue", fg="red",command=qw.destroy, width=10) Yes_btn.pack(padx=10, pady=10, side=LEFT) Yes_btn = Button(frame1, text="Yes", bg="light blue", fg="red",command=quit, width=10) Lbl = Label(frame1, text="are you sure you want to quit") # this is the code i designed and is working fine with me and i hope will resolve your issue as well.īasically if u press yes then use quit command and in no button destroy the same message window.īetter not to create new functions for small small tasks # **************** quit code ***********įrame1 = Frame(qw, highlightbackground="green", highlightcolor="green",highlightthickness=1, bd=0) I thought exitsure = tk.Tk would make a new window, and then if they pressed the no button, it would only destroy exitsure, but if they chose the yes button, it would exit everything. Start_title = tk.Label(text="Welcome to THE MEGA POP QUIZ")īutton1 = tk.Button(text="BEGIN", command = BEGIN)ĮxitButton = tk.Button(text="EXIT", width = 14, command = close_window) Heres my code so far: import tkinter as tkĪreyousure = tk.Label(text="Are you sure you want to exit?")ĮxitYes = tk.Button(text="Yes", command = closeyes)ĮxitNo = tk.Button(text="No", command = closeno) I've only just started using tkinter so I am not sure how to proceed: so far my app overlays my exit screen on top of my title screen and makes a seemingly random new blank windows. I want to have an "exit" button that when you press it, a new window will pop up asking if you're sure you want to exit.
0 Comments
Leave a Reply. |