title: Noughts and Crosses Tkinter project
body: <p>Alright so basically I've been set a task by my Tutor to create a GUI based Python game of Noughts and Crosses <strong>without using classes</strong>, so far here's what I've come up with. One question I have is how can I make it so every turn it toggles the player to "X" then the next "O" so that they can take turns, I have tried a lot of methods but I need help haha.
  Thanks!</p>
  
  <p><strong>Here's the Code:</strong>    </p>
  
  <pre><code>player = "O"
  from tkinter import *
  
  game = Tk()
  game.title("Noughts and Crosses")
  
  game.geometry("")
  
  app = Frame(game)
  app.grid()
  
  def tl():
      topLeft.configure(text = player)
  
  def tm():
      topMid.configure(text = player)
  
  def tr():
      topRight.configure(text = player)
  
  def ml():
      midLeft.configure(text = player)
  
  def mm():
      midMid.configure(text = player)
  
  def mr():
      midRight.configure(text = player)
  
  def bl():
      botLeft.configure(text = player)
  
  def bm():
      botMid.configure(text = player)
  
  def br():
      botRight.configure(text = player)
  
  #Top Row
  topLeft = Button(app, text = "-", activebackground="red", command=tl)
  topLeft.grid(row = 0, column = 0, ipadx=20, ipady=18, padx=10, pady=10)
  
  topMid = Button(app, text = "-", activebackground="red", command=tm)
  topMid.grid(row = 0, column = 1, ipadx=20, ipady=18, padx=10, pady=10)
  
  topRight = Button(app, text = "-", activebackground="red", command=tr)
  topRight.grid(row = 0, column = 2, ipadx=20, ipady=18, padx=10, pady=10)
  
  #Middle Row
  midLeft = Button(app, text = "-", activebackground="red", command=ml)
  midLeft.grid(row = 1, column = 0, ipadx=20, ipady=18, padx=10, pady=10)
  
  midMid = Button(app, text = "-", activebackground="red", command=mm)
  midMid.grid(row = 1, column = 1, ipadx=20, ipady=18, padx=10, pady=10)
  
  midRight = Button(app, text = "-", activebackground="red", command=mr)
  midRight.grid(row = 1, column = 2, ipadx=20, ipady=18, padx=10, pady=10)
  
  
  #Bottom Row
  botLeft = Button(app, text = "-", activebackground="red", command=bl)
  botLeft.grid(row = 2, column = 0, ipadx=20, ipady=18, padx=10, pady=10)
  
  botMid = Button(app, text = "-", activebackground="red", command=bm)
  botMid.grid(row = 2, column = 1, ipadx=20, ipady=18, padx=10, pady=10)
  
  botRight = Button(app, text = "-", activebackground="red", command=br)
  botRight.grid(row = 2, column = 2, ipadx=20, ipady=18, padx=10, pady=10)
  
  game.mainloop()
  </code></pre>