MCPcopy Index your code
hub / github.com/geekcomputers/Python / handle_click

Function handle_click

Snake Game Using Turtle/main.py:128–137  ·  view source on GitHub ↗

Main click handler to delegate actions based on button clicks.

(x, y)

Source from the content-addressed store, hash-verified

126 return False
127
128def handle_click(x, y):
129 """Main click handler to delegate actions based on button clicks."""
130 if game_state == "start" and is_click_on_button("Play", x, y):
131 start_game()
132 elif game_state == "playing" and is_click_on_button("Pause", x, y):
133 toggle_pause_resume()
134 elif game_state == "paused" and is_click_on_button("Resume", x, y):
135 toggle_pause_resume()
136 elif game_state == "game_over" and is_click_on_button("Restart", x, y):
137 restart_game()
138
139# --- KEYBOARD HANDLERS ---
140def handle_snake_up():

Callers

nothing calls this directly

Calls 4

is_click_on_buttonFunction · 0.85
toggle_pause_resumeFunction · 0.85
restart_gameFunction · 0.85
start_gameFunction · 0.70

Tested by

no test coverage detected