user interface - very basic python GUI program help -
so i'm working on pretty basic program in 1 of 3 "doors" randomly selected. choice compared user's choice , user wins if choice same randomly selected one.
so basically, want re-set text in gui based on whether user correct or not. there "settext" method in graphics library i'm using (comes textbook) should trick reason keep getting error:
label.settext("congrats! got it!") attributeerror: 'nonetype' object has no attribute 'settext'
but i'm settext method text class!
user_select = win.getmouse() 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! got it!") wins = wins + 1 elif not selection.clicked(user_select): label.settext("sorry, try again") losses = losses + 1 print(wins, losses)
i don't whether complete fix, need replace this:
label = text(point(5,9), "hello").draw(win)
with this:
label = text(point(5,9), "hello") label.draw(win)
in version, text
object created , drawn, it's return value of draw
function gets assigned label
(and presumably, draw
returns none
).
Comments
Post a Comment