Lucian Baumgartner
Lucian Baumgartner

Reputation: 1

turtle.textinput() is not working in one of my codes but it works in the other

I am currently working on a game in python using the turtle library import. Before I add anything to the main game always test it in another python file to make sure it works.

I came across the turtle.textinput()

It worked in my test code but not in my actual game. When I tried to put it in the actual game it says

AttributeError: type object 'Turtle' has no attribute textinput 

This makes no sense. I use VS code so I don't understand what is going on please help

P.S. : I couldn't figure out the code highlight thing so I put it in brackets.

Upvotes: 0

Views: 428

Answers (2)

Victor Freitas
Victor Freitas

Reputation: 41

Note that textinput() is a method in the Screen instance, and not in the turtle.

from turtle import Screen

screen = Screen()

screen.textinput("Title Example", "Prompt example")

Upvotes: 0

Dheeraj NG
Dheeraj NG

Reputation: 11

textinput() is a method in Screen class

Upvotes: 1

Related Questions