when first studied check buttonsmy initial reaction waswhy do we need tkinter variables here at all when we can register button-press callbackslinked variables may seem superfluous at first glancebut they simplify some gui chores instead of asking you to accept this blindlythoughlet me explain why keep in mind that checkbutton' command callback will be run on every presswhether the press toggles the check button to selected or deselected state because of thatif you want to run an action immediately when check button is pressedyou will generally want to check the button' current value in the callback handler because there is no check button "getmethod for fetching valuesyou usually need to interrogate an associated variable to see if the button is on or off moreoversome guis simply let users set check buttons without running command callbacks at all and fetch button settings at some later point in the program in such scenariovariables serve to automatically keep track of button settings the demo check script' report method represents this latter approach of courseyou could manually keep track of each button' state in press callback handlerstoo example - keeps its own list of state toggles and updates it manually on command press callbacks example - pp \gui\tour\demo-check-manual py check buttonsthe hard way (without variablesfrom tkinter import states [def onpress( )states[inot states[ichange object not name keep track of states changes false->truetrue->false root tk(for in range( )chk checkbutton(roottext=str( )command=(lambda =ionpress( )chk pack(side=leftstates append(falseroot mainloop(print(statesshow all states on exit the lambda here passes along the pressed button' index in the states list otherwisewe would need separate callback function for each button here againwe need to use default argument to pass the loop variable into the lambdaor the loop variable will be its value on the last loop iteration for all of the generated functions (each press would update the tenth item in the listsee for background details on thiswhen runthis script makes the -check button display in figure - tkinter tourpart