AttributeError: 'Turtle' object has no attribute 'shapesize' on line 14

眉间皱痕 提交于 2021-02-10 18:35:15

问题


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"

回答1:


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.

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




回答2:


I also had this problem You can use Python with pygame instead of python with turtle because for some reason, it works



来源:https://stackoverflow.com/questions/60961758/attributeerror-turtle-object-has-no-attribute-shapesize-on-line-14

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!