Advertisement
here2share

# Tk_close_after_2s.py

Dec 26th, 2021
1,106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. # Tk_close_after_2s.py
  2.  
  3. from tkinter import Label, Tk
  4. root = Tk()
  5. prompt = 'hello'
  6. label1 = Label(root, text=prompt, width=len(prompt))
  7. label1.pack()
  8.  
  9. def close_after_2s():
  10.     root.destroy()
  11.  
  12. root.after(2000, close_after_2s)
  13. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement