# Graphical Version of Hangman # Had to bind event instead of using the command # Had to disable the button from Tkinter import * def handleLetter(letter): print "Letter guessed:", letter def letterPushed(event): pushedButton = event.widget letter = pushedButton.cget("text") # Get the configuration item named "text" handleLetter(letter) pushedButton.config(state=DISABLED) def createButtons(parent): letterFrame = Frame(parent) letterFrame.pack() # Create all the buttons for i in range(26): currentChar = chr(i+65) print currentChar b = Button(letterFrame, text=currentChar, padx=20) b.bind('