Advertisement
here2share

# Tk_counting_upward.py

Dec 26th, 2021
1,083
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. # Tk_counting_upward.py
  2.  
  3. import tkinter as tk
  4.  
  5. def counter_label(label):
  6.     def count():
  7.         label['text'] += 1
  8.         label.after(1000,count)
  9.     count()
  10.  
  11.  
  12. root = tk.Tk()
  13. root.title ("Counting Upward")
  14. label = tk.Label(root, fg = "green")
  15. label.pack()
  16. label['text'] = -1
  17. button = tk.Button(root, text='Stop', width=25, command=root.destroy)
  18. button.pack()
  19. counter_label(label)
  20. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement