but in the short programs that we will be writingwe should be okay object-oriented programming provides an alternative to global variables tic-tac-toe using tkinterin only about lines we can make working tic-tac-toe programfrom tkinter import def callback( , )global player if player =' ' [ ][cconfigure(text ' 'player ' elseb[ ][cconfigure(text ' 'player ' root tk( [[ , , ][ , , ][ , , ]for in range( )for in range( ) [ ][jbutton(font='verdana ' )width= bg'yellow 'command lambda = , =jcallback( , ) [ ][jgrid(row icolumn jplayer ' mainloop(the program worksthough it does have few problemslike letting you change cell that already has something in it we will fix this shortly firstlet' look at how the program does what it does starting at the bottomwe have variable player that keeps track of whose turn it is above that we create the boardwhich consists of nine buttons stored in two-dimensional list we use the lambda trick to pass the row and column of the clicked button to the callback function in the callback function we write an or an into the button that was clicked and change the value of the global variable player