Whiztech 0 Newbie Poster

The objective is to have the user guess the letters of a word which has to be the name of an object that can be seen. The user is presented with an array of 26 buttons corresponding to the 26 letters of the alphabet. Additionally the user is presented with a partially obscured picture of the object, underscores ( _ ) in place of each letter of the word, a simple graphics (consisting of lines & ovals) showing the hanging platform & noose. The game proceeds by the user clicking on a single button at each turn. On each successful click on of two events occur: 1) if the letter on the clicked button is present in the word, the underscores corresponding to that letter are replaced with the letter and the button is "grayed out" to making unclickable 2) if the letter on the clicked button is not in the word, the button is grayed out and the hangman graphics is updated to the next picture.


This is the code:

from myro import *
def main():
W = 500
H = 330
W_win = W + 100
H_win = 2 * H
win = GraphWin("Picture Browser",W_win,H_win)
animals =
n = pickOne(len(animals))
im = Image(Point(W_win/2,H/2 + 10),animals[n]+'.gif')
im.draw(win)
for i in range(10):
p =win.getMouse()
print p.x, p.y
win.close()

main()

Thank you.