Advertisement
Maks1235

Trying to make a simple click counter

Jul 3rd, 2025 (edited)
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. Python code:
  2.  
  3. button = 0
  4.  
  5. def button_up(btn):
  6. btn = btn + 1
  7. return (btn)
  8.  
  9.  
  10. import tkinter as tk
  11. root = tk.Tk()
  12. root.title("Click Game!")
  13. root.maxsize(300,300)
  14. root.minsize(300,300)
  15.  
  16.  
  17. button1 = tk.Button(root, text="Click me!", command=button_up(button))
  18. button1.pack()
  19.  
  20. label1 = tk.Label(root, text="Click Counter: ")
  21. label1.pack()
  22.  
  23. label2 = tk.Label(root, text=str(button))
  24. label2.pack()
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement