Created
February 28, 2026 14:49
-
-
Save elliottminns/1e0a11c9b629db8339de7512878bea97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package require Tk | |
| set count 0 | |
| # Label that displays the count | |
| label .lbl -text "Count: $count" -font {Helvetica 18} | |
| pack .lbl -padx 20 -pady 10 | |
| proc update {} { | |
| global count | |
| .lbl configure -text "Count: $count" | |
| } | |
| # Button that increments count | |
| button .btn -text "+1" -command { | |
| incr count | |
| update | |
| } | |
| pack .btn -padx 20 -pady 10 | |
| # Button to reset the count | |
| button .reset -text "Reset" -command { | |
| set count 0 | |
| update | |
| } | |
| pack .reset -padx 20 -pady 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice