title: NameError: name 'check' is not defined, but it is defined
body: <p>It says check isn't defined, but i did, right?  I am planing on a Tic Tac Toe game with a GUI so it looks better than just console. Im new to object-oriented programing, if there are good guides out there, please link them. Also i need an idea for my player (spieler), to not use it globaly</p>
  <pre><code>import tkinter as tk
      
  root = tk.Tk()
  root.title(&quot;&lt;Tic_Tac_Toe&gt;&quot;)
  board = [[&quot;&quot;,&quot;&quot;,&quot;&quot;],[&quot;&quot;,&quot;&quot;,&quot;&quot;],[&quot;&quot;,&quot;&quot;,&quot;&quot;,]]
  
  class Commands():
      def __init__(self, spieler):
          board = [[&quot;&quot;,&quot;&quot;,&quot;&quot;],[&quot;&quot;,&quot;&quot;,&quot;&quot;],[&quot;&quot;,&quot;&quot;,&quot;&quot;,]]
          self.spieler = spieler
  
      def check(self):
          if self.board[self.location[0]][self.location[1]] == &quot;&quot;:
              self.board[self.location[0]] = self.spieler
              print(self.board)
              return(self.board)
  
      def change00(self):
          location = [0,0]
          new_board = check()
          self.board = new_board
  
  # same for button 01, 02,....
  
  class Tic_Tac_Toe(tk.Frame):
      def __init__(self, main):
          tk.Frame.__init__(self, main)
          self.commands = Commands(&quot;x&quot;)
          self.setup_gui()
  
      def setup_gui(self):
          self.pack(fill=&quot;both&quot;, expand=True)
          self.configure(bg=&quot;white&quot;)
  
          self.button00 = tk.Button(self, text=&quot;1&quot;, command = self.commands.change00)
          self.button01 = tk.Button(self, text=&quot;2&quot;)
          self.button02 = tk.Button(self, text=&quot;3&quot;)
          self.button10 = tk.Button(self, text=&quot;4&quot;)
          self.button11 = tk.Button(self, text=&quot;5&quot;)
          self.button12 = tk.Button(self, text=&quot;6&quot;)
          self.button20 = tk.Button(self, text=&quot;7&quot;)
          self.button21 = tk.Button(self, text=&quot;8&quot;)
          self.button22 = tk.Button(self, text=&quot;9&quot;)
  
          self.button00.grid(row=0, column=0, sticky=&quot;nsew&quot;)
          self.button01.grid(row=0, column=1, sticky=&quot;nsew&quot;)
          self.button02.grid(row=0, column=2, sticky=&quot;nsew&quot;)
          self.button10.grid(row=1, column=0, sticky=&quot;nsew&quot;)
          self.button11.grid(row=1, column=1, sticky=&quot;nsew&quot;)
          self.button12.grid(row=1, column=2, sticky=&quot;nsew&quot;)
          self.button20.grid(row=2, column=0, sticky=&quot;nsew&quot;)
          self.button21.grid(row=2, column=1, sticky=&quot;nsew&quot;)
          self.button22.grid(row=2, column=2, sticky=&quot;nsew&quot;)
  
          self.rowconfigure(index=0, weight=1)
          self.rowconfigure(index=1, weight=1)
          self.rowconfigure(index=2, weight=1)
          self.columnconfigure(index=0, weight=1)
          self.columnconfigure(index=1, weight=1)
          self.columnconfigure(index=2, weight=1)
  
  
  run_app = Tic_Tac_Toe(root)
  root.mainloop()
  </code></pre>