Please enable JavaScript to use CodeHS

All Product Updates

Stay up to date with the latest features, improvements, and fixes to CodeHS.

Ask for Text in Python Turtle Projects

Python Turtle Interactive Programs

Students can ask for text in a pop-up dialog and use the response in their Python Turtle drawings and interactive projects.

Ask for Text in Python Turtle Projects

Give students a new way to make their Python Turtle projects interactive. With turtle.textinput(title, prompt), a program can ask a question in a pop-up dialog and use the answer to personalize a drawing, tell a story or respond to a choice.

The function returns the entered text when students choose OK, or None when they choose Cancel. Students can also use turtle.Screen().textinput(...).

This adds a text dialog alongside the existing console input() workflow. It does not add numeric-input dialogs. On the Pyodide runner, it requires a supported browser; automatic grading and solution previews do not open the dialog and return None instead.