Python乌龟模块导致OS X崩溃

val*_*ieo 11 python macos turtle-graphics

我正在研究Think Python第4章,他们告诉您键入以下内容以查看是否具有turtle模块:

import turtle
bob = turtle.Turtle()
Run Code Online (Sandbox Code Playgroud)

应该打开一个新窗口,但它会使我的计算机崩溃。我已经看到它冻结了我的计算机,使我无法移动光标或更改窗口,因此必须重新启动它。而且我也看到它关闭了我所有的程序并重新打开它们。

我正在运行从Mosave 10.14.6版的Macbook Air上从Anaconda下载的Python 3.7。

编辑:当我在下面运行BenajahTX的建议时,我得到此错误消息打印16次: CGSTrackingRegionSetIsEnabled returned CG error 268435459

有什么线索导致此问题或如何解决?

小智 1

尝试设置屏幕和主循环

    window = turtle.Screen()
    window.setup(width,height)
    while True:
            window.update()
    window.mainloop()
Run Code Online (Sandbox Code Playgroud)