Tested on a Mac > terminal > python script.py
import Tkinter as tk root = tk.Tk() # Function counter = 0 def btn1(): button1.config(state="disabled") counter = 0 def count(): global counter counter += 1 label.config(text=str(counter)) label.after(1000, count) count() # setup form root.title("Welcome to Commlink") label = tk.Label(root, fg="dark green") label.pack() button1 = tk.Button(root, text='Start', width=25, command=btn1) button1.pack() button2 = tk.Button(root, text='Stop', width=25, command=root.destroy) button2.pack() root.mainloop()
Minimizing Window – Make Top Most
import Tkinter as tk import webbrowser # OPEN URL new = 2 url = "http://google.com" def btn3(): webbrowser.open(url,new=new) command=quit(root) # RUN TIMER counter = 11 def btn1(): root.wm_state('iconic') button1.config(state="disabled") counter = 11 def count(): global counter counter -= 1 if counter == 0: retControl() counter = 11 label1.config(text="") root.deiconify() return label1.config(text=str(counter)+ " seconds") label1.after(1000, count) count() # Return Snooze Button Control def retControl(): button1.config(state="active") # Kill Window def quit(self): self.destroy() exit() # form root = tk.Tk() root.title("Technology Notification") # removes title bar # root.overrideredirect(True) label1 = tk.Label(root, fg="red") label1.pack() label2 = tk.Label(root, text = "Welcome to your first notification!\n\n") label2.pack() button1 = tk.Button(root, text='Snooze', width=25, command=btn1) button1.pack() button2 = tk.Button(root, text='Close', width=25, command=root.destroy) button2.pack() button3 = tk.Button(root, text='Open URL', width=25, command=btn3) button3.pack() # place window on top root.attributes('-topmost', True) root.mainloop()
Screenshot
Notes
Same code…
Tested in Windows > IDLE > script.py