Write the correct title code that will do the following.
1) Ask the user to put the name of the nurtle screen.
2) Ask the user to input the background color of the turtle screen.
3) Ask the user to input a number that will instruct the turtle to move in accordance with number entered.
4) Ask the user to mput a number that will instruct the tunle to turn in accordance with the number
from turtle import *
from turtle import TurtleGraphicsError
def set_bg_color():
try:
t.screen.bgcolor(textinput("Background", "Background color:"))
except TurtleGraphicsError:
set_bg_color()
t = Turtle()
window = Screen()
window.title(textinput("Title", "Window title:"))
t.right(numinput("Turn", "Turn right", minval=0))
t.fd(numinput("Move", "Move forward", minval=0))
set_bg_color()
t.screen.mainloop()
Comments
Leave a comment