+ 2
Guys, Please help me, I can't import Turtle in python.
I think Something is wrong. When I import Turtle in python, It does't import.. I used Python 3.7 and I just input import turtle as t. But This sentence came out. Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\최민석\AppData\Local\Programs\Python\Python37-32\turtle.py", line 2, in <module> t.shape() AttributeError: module 'turtle' has no attribute 'shape' How to I solve it? please give me a favor.
4 Réponses
+ 7
Simple. The turtle module does not have a "shape" function
+ 5
print(dir(turtle)) shows its method, but import it first
+ 5
I think you might have forgotten the parentheses when you initialized t as an instance of turtle. You need to write t = turtle(), not t = turtle. Otherwise t will refer to the whole module, which indeed doesn't have a shape attribute. But t as an instance of turtle should have one
/Edit: sorry, I didn't read the second sentence.
Try:
import turtle
t = turtle()
+ 3
sorry i dont know. i didnt even know you could import turtle into python. sorry