title: How do I get buttons to do things for gui hangman
body: <p>I am new to python and have decided to create a hangman game as a GUI with tkinter. I have stumbled across this problem where I can't get my buttons to do what I want. Specifically, I want them to check if the letter is in the mystery word and print it in the position of the letter in the word if it is. Any tips or suggestions will be helpful. </p>
  
  <pre><code>from tkinter import *
  import random
  from tkinter import Label, Canvas
  
  root = Tk()
  root.title("Hangman Project")
  c: Canvas = Canvas(root, height=500, width=500, bg="white")
  c.pack()
  height = 400
  width = 400
  head = c.create_oval(70, 70, 130, 130)
  neck = c.create_line(100, 130, 100, 150)
  body = c.create_rectangle(70, 150, 130, 220, fill="orange")
  arm1 = c.create_line(130, 170, 150, 120)
  arm2 = c.create_line(70, 170, 50, 120)
  leg1 = c.create_line(110, 220, 145, 275)
  leg2 = c.create_line(90, 220, 55, 275)
  
  
  def gallows():
      c.create_line(width / 40, height / 8, width / 4, height / 8)
      c.create_line(width / 40, height / 8, width / 40, height / 1.6)
      c.create_line(0, height / 1.6, width / 20, height / 1.6)
      c.create_line(width / 40, height / 5, width / 4, height / 8)
      c.create_line(width / 4, height / 8, width / 4, height / 5.7)
  
  
  line = """Antiquated outdated fashioned Choleric easily angered Diorama 
      model scene Fecund fertile Inebriation drunkenness intoxication Marshal gather 
      together Parity equality Profound meaning Servile overly submissive groveling Usurp 
  """
  line.lower()
  word_list = list(line.split(" "))
  correct_ans = word_list
  prize_word = random.choice(word_list)
  spaces = " ".join(prize_word)
  mystery_word = " ".join("_" * len(prize_word))
  y = Label(root, text=mystery_word, font="Times, 30")
  y.place(x=190, y=300)
  
  
  def makebuttons():
      count = 0
      lst = []
      if count &lt;= 27:
          for letter in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
              lst.append(letter)
          for letter in lst:
              Buttons = Button(master=root, text=letter, font="Times, 20")
              Buttons.pack()
              Buttons.place(x=20 * count, y=460)
              count += 1
  
  
  
  makebuttons()
  gallows()
  root.mainloop()
  </code></pre>