'Turtle module: Why is screen.update() returning a blank screen?

I'm building a snake game following a tutorial. But I've run into a problem.

from turtle import Screen, Turtle

screen = Screen()
screen.setup(width=600, height=600)
screen.bgcolor("black")
screen.title("My Snake Game")
screen.tracer(0)

segments = []
starting_positions = [(0, 0), (-20, 0), (-40, 0)]
for position in starting_positions:
    new_segment = Turtle("square")
    new_segment.color("white")
    new_segment.penup()
    new_segment.goto(position)
    segments.append(new_segment)


is_game_on = True
while is_game_on:
    for seg in segments:
        seg.forward(20)
    screen.update()

screen.exitonclick()

Here, screen.update() gives me a blank screen instead of an animated "snake". Why?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source