Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python turtle module causes OS X to crash

Tags:

I'm working through Think Python chapter 4, where they tell you to type the following to see if you have the turtle module:

import turtle
bob = turtle.Turtle()

This is supposed to open a new window, but instead, it crashes my computer. I've seen it freeze my computer where I can't move the cursor or change windows, and I have to restart it. And I've also seen it close all my programs and re-open them.

I'm running Python 3.7 downloaded from Anaconda on a Macbook Air with Mojave version 10.14.6.

EDIT: When I run BenajahTX's suggestion below, I get this error message printed 16 times: CGSTrackingRegionSetIsEnabled returned CG error 268435459

Any clue what is causing this or how to fix it?

like image 579
valerieo Avatar asked Aug 11 '19 21:08

valerieo


People also ask

How do I turn off turtle tracer in Python?

print(turtle. tracer(0)) is used for turn off the the turtle tracer animation.

What is the purpose of python turtle graphics module?

turtle is a pre-installed Python library that enables users to create pictures and shapes by providing them with a virtual canvas.

How do you reset turtle turtle Python?

turtle. clearscreen() aka turtle. Screen(). clear() Deletes all drawing and all turtles, reseting the window to it's original state.

What does T turtle turtle () do?

turtles() This function is used to return the list of turtles on the screen.


1 Answers

try and set the screen and mainloop

    window = turtle.Screen()
    window.setup(width,height)
    while True:
            window.update()
    window.mainloop()
like image 54
BenajahTX Avatar answered Sep 30 '22 17:09

BenajahTX