gui programming with tkinter buttons[igrid(row= column=imainloop(we note few things about this program firstwe set buttons=[ ]* this creates list with things in it we don' really care what thoset things are because they will be replaced with buttons an alternate way to create the list would be to set buttons=[and use the append method we only use one callback function and it has one argumentwhich indicates which button was clicked as far as the lambda trick goeswithout getting into the detailscommand=callback(idoes not workand that is why we resort to the lambda trick you can read more about lambda in section an alternate approach is to use classes global variables let' say we want to keep track of how many times button is clicked an easy way to do this is to use global variable as shown below from tkinter import def callback()global num_clicks num_clicks num_clicks label configure(text'clicked {times format(num_clicks)num_clicks root tk(label label(text'not clicked 'button button(text'click me 'command=callbacklabel grid(row= column= button grid(row= column= mainloop(we will be using few global variables in our gui programs using global variables unnecessarilyespecially in long programscan cause difficult to find errors that make programs hard to maintain