AttributeError:"Turtle"对象在第14行没有属性"shapesize" [英] AttributeError: 'Turtle' object has no attribute 'shapesize' on line 14

查看:71
本文介绍了AttributeError:"Turtle"对象在第14行没有属性"shapesize"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to make a turtle game on Repl.it and I don't know why this error keeps coming up. Here is my code:

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"

推荐答案

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

It seems that the implementation of the turtle library on repl.it is somewhat limited and not all commands are available. You can either run it locally to use all commands or remove incompatible commands.

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

这篇关于AttributeError:"Turtle"对象在第14行没有属性"shapesize"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆