我正在学习Python的Turtle类。在终端中运行shp.py
文件时,我遇到了多个错误:
出了什么问题?
import turtle as myTurtle
def draw_shape():
window = myTurtle.Screen()
window.bgcolor("yellow")
brack = myTurtle.Turtle()
brack.shape("turtle")
brack.speed(2)
c = 1
while c < 5:
brack.forward(100)
brack.right(90)
c = c+1
rosy = myTurtle.Turtle()
rosy.shape("arrow")
rosy.color("blue")
rosy.circle(100)
matt = myTurtle.Turtle()
matt.shape("circle")
i = 1
while i < 4:
matt.forward(320)
matt.left(120)
i = i+1
window.exitonclick()
draw_shape()
答案 0 :(得分:0)
目前,您的脚本正在自行导入。对文件名的简单更改可以解决此问题。
Go to My Documents -> Locate your file -> Right click on it -> Click Rename -> Enter a new name like myTurtle.py