0

I am currently learning about the turtle module in Python.

However, I stumbled upon an issue. I want to note that I ran everything on Jupyter Notebook in Anaconda, on my Macbook air (M1 chip).

The issue is when I ran this code below, everything went fine, except for when I closed the window, it just froze, my mouse cursor just kept spinning around on end. I had to force quit. And after that, the Jupyter Notebook page on which I ran the codes died, popping up a window saying "The kernel appears to have died. It will restart automatically" I have repeated again and again, but the same issue still occurs every single time.

import turtle

turtle.forward(200)
turtle.setheading(90)
turtle.penup()
turtle.forward(40)
turtle.pendown()
turtle.forward(50)
turtle.penup()
turtle.forward(50)
turtle.forward(50)
turtle.pendown()
turtle.forward(60)
turtle.forward(100)
turtle.done()

Before adding turtle.done() at the end, the situation was even worse: the turtle window lagging, and my mouse cursor spinning even when I did not try to close the window.

This is so annoying that I am not able to close the window without having to force quit and kernel dying.

However, it is weird that I am able to close the window without any difficulty when I ran this code, which is more complex:

from turtle import *

color('red', 'yellow')
begin_fill()

while True:
    forward(200)
    left(170)
    if abs(pos()) < 1:
        break
end_fill()
done()

The capture of my screen when I ran the first code

ggorlen
  • 44,755
  • 7
  • 76
  • 106

0 Answers0