I'm trying to make a snake game and when I write the codes to create the window, I get an image like this:
and the codes I wrote:
import turtle
window = turtle.Screen()
window.title("Snake Game")
window.bgcolor('lightgreen')
window.setup(width=600 , height=600)
window.tracer(0)
head = turtle.Turtle()
head.speed(0)
head.color('white')
head.shape('square')
head.penup()
head.goto(0, 100)
head.direction = 'stop'
while True :
window.update()
turtle.done
The other problem is when i close the window i get an error like this:
Traceback (most recent call last):
File "practice.py", line 19, in <module>
window.update()
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/turtle.py", line 1304, in update
t._update_data()
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/turtle.py", line 2647, in _update_data
self.screen._incrementudc()
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/turtle.py", line 1293, in _incrementudc
raise Terminator
turtle.Terminator
Do you have any solution for this problem?