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

Method update_scoreboard

Snake Game Using Turtle/scoreboard.py:33–41  ·  view source on GitHub ↗

Clears and rewrites the score and high score in the top-left corner.

(self)

Source from the content-addressed store, hash-verified

31 return 0
32
33 def update_scoreboard(self):
34 """Clears and rewrites the score and high score in the top-left corner."""
35 self.clear()
36 self.color(colors.SCORE_COLOR)
37 # Dynamically calculate position to be well-placed in the header
38 x_pos = -self.screen.window_width() / 2 + 30
39 y_pos = self.screen.window_height() / 2 - 60
40 self.goto(x_pos, y_pos)
41 self.write(f"Score: {self.score} | High Score: {self.high_score}", align=ALIGNMENT, font=SCORE_FONT)
42
43 def increase_score(self):
44 """Increases score and updates the display."""

Callers 5

__init__Method · 0.95
increase_scoreMethod · 0.95
resetMethod · 0.95
start_gameFunction · 0.80
toggle_pause_resumeFunction · 0.80

Calls 2

clearMethod · 0.80
colorMethod · 0.80

Tested by

no test coverage detected