Ask coding questions

← Back to all posts
[Python (with Turtle)] Why am I getting an error?
Babbel (64)

I wanted to create a small turtle game.
But if I try to change the shape size I get an error:
https://storage.googleapis.com/replit/images/1533812092503_f2f495d6bfc786b2a1563733d7cc8db6.pn
Is the interpreter broken or is there another reason?
The Turtle class definitely has a method 'shapesize()'.

Here's my code: https://repl.it/@Babbel/Python-Turtle-Error

Comments
hotnewtop
kowusu (0)

Python with pygame seems to work better with turtle than python with turtle. Although adding the '=' works, I still had issues. However, with the pygame library, turtle had no issues.

ColePete (30)

@Babbel I think I fixed it!

import turtle

s = turtle.Screen()

t = turtle.Turtle()
t.shapesize = (2, 2)

All you had to do was add an = sign

YuAndy (74)

turtle.shapesize()does exist, but I don't think you could do that in REPL for some reason. You can try screen=turtle.Screen() and then type in the coordinates of every angle in the shape using register_shape. For example screen.register_shape((10,10),(-10,10),(-10,-10),(10,-10)) will create a 20x20 square. With that you could create bigger shapes.

baco (0)

+1
(I ran this code on my laptop without error...(?))

Four_Of_Clubs (96)

I had the same problem. I still don't know If you can change the size of turtles on here.