Python error AttributeError Turtle object has no attribute Shape

+1 vote

I'm trying to build the snake game using the python module turtle. This is my code

import turtle

#set up the screen
wn = turtle.Screen()
wn.title("snake game")
wn.bgcolor("Blue")
wn.setup(width=600, height=600)
wn.tracer(0)

#Snake Head
head = turtle.Turtle()
head.speed(0)
head.Shape("Square")
head.color("Black")
head.penup()
head.goto(0, 0)
head.direction = "stop"
turtle.mainloop()

Error:

  head.Shape("Square")
AttributeError: 'Turtle' object has no attribute 'Shape'

Jun 19, 2019 in Python by Nagya
21,064 views

3 answers to this question.

+1 vote

Hey @Nagya, replace

python.Shape("Square")

with the following:

python.shape("square")

Python is case sensitive

Hope it helps!!

If you need to know more about Python, It's recommended to join Python course today.

Thanks!

answered Jun 19, 2019 by Faiza
Nagya is asking about atrribute and ur telling that python is case sensitive....

Well, the attribute here is "square" and since python is case sensitive, "Square" and "square" make a difference.

Hence the error:

AttributeError: 'Turtle' object has no attribute 'Shape'
0 votes
just change the file name to "turtle_something.py"
answered Sep 11, 2020 by Aflah
0 votes

Your problem is with the last line 

"

head.direction = "stop"
"
answered Nov 20, 2021 by anonymous

Related Questions In Python

0 votes
2 answers

Python Pandas error: AttributeError: 'DataFrame' object has no attribute 'rows'

Try this: data=pd.read_csv('/your file name', delim_whitespace=Tru ...READ MORE

answered Dec 10, 2020 in Python by anonymous
• 82,880 points
130,345 views
0 votes
1 answer

Python error "AttributeError: '_Screen' object has no attribute 'onkeypress'"

Instead of  wn.onkeypress(go_up, "w") Try wn.onkey(go_uo, " ...READ MORE

answered Jul 5, 2019 in Python by Pooja
4,425 views
0 votes
1 answer

Python error "'str' object has no attribute 'turtle' in Python turtle"

There is a syntax error. Change the ...READ MORE

answered Jul 9, 2019 in Python by Pallavi
7,073 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,067 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
3,485 views
0 votes
1 answer

Python error "AttributeError: '_Screen' object has no attribute 'mainloop'" python module turtle

Hey @Nagya, replace  wn.mainlopp() with turtle.mainloop() ...READ MORE

answered Jun 19, 2019 in Python by Faiza
6,506 views
0 votes
1 answer

Python error "AttributeError: 'str' object has no attribute 'casefold'"

Check your python version. Casefold is possible ...READ MORE

answered Jul 4, 2019 in Python by Yesha
5,792 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP