为什么带有海龟图形的屏幕会自行关闭

时间:2020-08-27 19:24:34

标签: python turtle-graphics

为什么带有乌龟图形的屏幕会自动关闭?

import turtle
circle = turtle.Turtle()
circle.color("pink")
circle.pensize(5)
circle.speed(5)
circle.circle(10)
circle.done()

2 个答案:

答案 0 :(得分:1)

将turtle.done()代替circle.done()

答案 1 :(得分:0)

乌龟窗口自动关闭,因为您的程序遇到了错误:

AttributeError: 'Turtle' object has no attribute 'done'

改为使用turtle.done()

import turtle
circle = turtle.Turtle()
circle.color("pink")
circle.pensize(5)
circle.speed(5)
circle.circle(10)
turtle.done()

请参阅文档here