diff --git a/Color_Game/main.py b/Color_Game/main.py index 4d1e68d9..48cfd72f 100644 --- a/Color_Game/main.py +++ b/Color_Game/main.py @@ -6,13 +6,14 @@ score = 0 timeleft = 30 +# BUG: Score doesn't update when user enters wrong color +# FIX: def next_colour(): global score, timeleft - if timeleft > 0: - user_input = e.get().lower() + user_input = e.get().strip().lower() correct_color = colours[1].lower() - + if user_input == correct_color: score += 1 @@ -20,8 +21,6 @@ def next_colour(): random.shuffle(colours) label.config(fg=colours[1], text=colours[0]) score_label.config(text=f"Score: {score}") - - def countdown(): global timeleft if timeleft > 0: @@ -96,4 +95,5 @@ def start_game(event): e.focus_set() -window.mainloop() \ No newline at end of file + +window.mainloop()