Using the code, you create two buttons that launch the command:
puts $count
In your example, when you press the button, the variable $ count is "1", so it "puts" and displays this value. For proper operation, you need to create 2 buttons. The first button command should be "puts 0". The second button command should be "puts 1". We must apply the replacement when creating the button. For instance:
-command [list puts $count] -command "puts $count"
source share