import turtle as tu
turtle = tu.Turtle()
turtle.color("cyan1")
turtle.shape("turtle")
square_len = tu.textinput("Square Lenght", "Lenght")
def draw_square():
turtle.forward(square_len)
turtle.right(square_len)
turtle.right(square_len)
turtle.right(square_len)
draw_square()
screen = tu.Screen()
screen.exitonclick()
I get this error when I run the program
Traceback (most recent call last):
File “c:UsersHpDesktopCodestemp.py”, line 6, in
square_len = turtle.textinput(“Square Lenght”, “Lenght”)
^^^^^^^^^^^^^^^^
AttributeError: ‘Turtle’ object has no attribute ‘textinput’
I want to take input from user
square_len
then draw a square with it
New contributor
Shriram Dekhane is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.