We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a655b86 commit 6917de2Copy full SHA for 6917de2
main.py
@@ -46,16 +46,17 @@ def increment_score():
46
score += 1
47
score_var.set(f"Score: {score}")
48
49
-def render_point(point, color):
+def render_point(point, color, square=True):
50
coord_x, coord_y = point.x * TILE_WIDTH, point.y * TILE_WIDTH
51
- return canvas.create_rectangle(coord_x, coord_y,
52
- coord_x + TILE_WIDTH,
53
- coord_y + TILE_WIDTH,
54
- fill=color,
55
- outline='white')
+ renderer = canvas.create_rectangle if square else canvas.create_oval
+ return renderer(coord_x, coord_y,
+ coord_x + TILE_WIDTH,
+ coord_y + TILE_WIDTH,
+ fill=color,
56
+ outline='white')
57
58
def render_food(food):
- render_point(food, 'red')
59
+ render_point(food, 'red', square=False)
60
61
def render_head(snake):
62
if snake.next_position() == food or snake.head == food:
0 commit comments