I am using Python Turtle-graphics to draw some figures. However, I am not able to create it again once screen has been closed.
For example, following simple code works:
import turtle
t = turtle.Turtle()
t.speed(0)
t.dot()
t.goto(100, 100)
turtle.done()
However, in following code, error occurs at time of second drawing:
import turtle
# FIRST DRAWING:
t = turtle.Turtle()
t.speed(0)
t.dot()
t.goto(100, 100)
turtle.done()
# SECOND DRAWING:
t = turtle.Turtle() # ERROR OCCURS HERE WHEN FIRST WINDOW IS CLOSED.
t.speed(0)
t.dot()
t.goto(-100, -100)
turtle.done()
The error is:
Traceback (most recent call last):
File "rptTurtle.py", line 12, in <module>
t = turtle.Turtle()
File "/usr/lib/python3.7/turtle.py", line 3816, in __init__
visible=visible)
File "/usr/lib/python3.7/turtle.py", line 2557, in __init__
self._update()
File "/usr/lib/python3.7/turtle.py", line 2660, in _update
self._update_data()
File "/usr/lib/python3.7/turtle.py", line 2646, in _update_data
self.screen._incrementudc()
File "/usr/lib/python3.7/turtle.py", line 1292, in _incrementudc
raise Terminator
turtle.Terminator
Where is the problem and how can it be corrected?