首页 > 解决方案 > AttributeError: 'Turtle' 对象在第 14 行没有属性 'shapesize'

问题描述

我正在尝试在 Repl.it 上制作海龟游戏,但我不知道为什么这个错误不断出现。这是我的代码:

import turtle

wn = turtle.Screen()
wn.bgcolor("white")
wn.setup(width=800, height=800)
wn.tracer(0)

# Set up the ground

ground = turtle.Turtle()
ground.color("white")
ground.shape("square")
ground.speed(0)
ground.shapesize(stretch_wid=200, stretch_len=20)
ground.speed(0)
ground.color("black")
ground.penup()
ground.goto(0, -400)
ground.direction = "stop"

标签: pythonobjectimportattributesattributeerror

解决方案


似乎 repl.it 上的 turtle 库的实现有些受限,并非所有命令都可用。您可以在本地运行它以使用所有命令或删除不兼容的命令。

来源: https ://repl.it/talk/ask/Turtle-python-resizing/7312


推荐阅读