So I'm working on a pretty basic program in which one of three "doors" is randomly selected. This choice is compared with the user's choice and the user wins if his choice is the same as the randomly selected one.
So basically, I want to re-set the text in the GUI based on whether the user is correct or not. There is a "setText" method in the graphics library that I'm using (comes with the textbook) that should do the trick but for some reason I keep getting this error:
label.setText("Congrats! You got it!")
AttributeError: 'NoneType' object has no attribute 'setText'
But I'm certain that setText is a method for the text class!
user_select = win.getMouse()
for i in range(n):
selection = door_list[randrange(0,3)]
user_select = win.getMouse()
label = Text(Point(5,9), "hello").draw(win)
if selection.clicked(user_select):
label.setText("Congrats! You got it!")
wins = wins + 1
elif not selection.clicked(user_select):
label.setText("Sorry, try again")
losses = losses + 1
print(wins, losses)