# Initialize lst to be an empty list set lst {} # Initialize the value to append to the list set val 0 # Create a label showing the contents of the variable lst label .showLst -textvar lst # The command for this button uses curlies to cause the # button command to use "$val" instead of replacing the # $val with the current value ov "val" # Replace the curlies with quotes to see what happens. button .addToLst -text "Add Next Number" \ -command {lappend lst $val; set val [expr $val+1]} # Grid the button and list grid .showLst -row 1 -column 1 grid .addToLst -row 2 -column 1