Question: Here is a simple Python hangman game program: #!/usr/bin/python import random from Tkinter import * words=[ minimize, apple, thanksgiving, hyperbole, creampuff, quiet, networking, cybersecurity ]

Here is a simple Python hangman game program:

#!/usr/bin/python import random from Tkinter import * words=[ "minimize", "apple", "thanksgiving", "hyperbole", "creampuff", "quiet", "networking", "cybersecurity" ] class hangman: def __init__(self): """ Create a new game. Choose a word randomly from the list of possible words and set it as the target of the game. Initialize the turn counter to 0. Initialize guessed (total list of guest chars) and correct (list of correct guesses) to empty lists. """ self.turns = 10 self.guessed = [] self.correct = [] self.target = words[random.randrange(len(words))] def getStatus(self): """ Returns a list of characters containing the word. Correctly guessed characters will be unmasked. Unguessed chars will be masked """ out=[] for c in self.target: if c in self.guessed: out.append(c) else: out.append("_") return out def guess(self, choice): """ guess if choice is in the target """ if choice in self.guessed: return self.turns self.guessed.append(choice) if choice in self.target: self.correct.append(choice) else: self.turns -= 1 def turnsLeft(self): return self.turns def won(self): return not '_' in self.getStatus() class HangmanGUI: def __init__(self, game): """ draw the GUI """ self.game = game # TODO # build out the GUI, place all components, and register # the callback functions root.mainloop() if __name__ == "__main__": random.seed() game = hangman() gui = HangmanGUI(game) 

ASSIGNMENT:

Insert code into the class HangmanGUI to:

Here is a simple Python hangman game program: #!/usr/bin/python import random from

Reimplement the game of Hangman, but this time with a graphical user interface. The design of the GUI is completely up to you, as long as you can effectively play the game, and some form of graphical progression is shown. My implementation looks like this: Hangman Hangman hyper_o_e o O Your guess: Guess Game Over! The word was: hyperbole

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!