#Jonathan Hudson #Student Number 12347890 #Date: 2020-08-26 #Lecture Practice #Move pointer to a second location based on user input in turtle #Import turtle import turtle #CONSTANTS WIDTH = 800 HEIGHT = 600 #Setup turtle pointer = turtle.Turtle() screen = turtle.getscreen() screen.setup(WIDTH, HEIGHT, 0, 0) screen.setworldcoordinates(0, 0, WIDTH, HEIGHT) pointer.hideturtle() screen.delay(delay=0) #Start in middle pointer.up() pointer.goto(WIDTH/2,HEIGHT/2) #Asking use for desired data sXLocation = input("Enter new x coordinate in (800,600) window: ") sYLocation = input("Enter new y coordinate in (800,600) window: ") sColor = input("Enter color [1:red otherwise:blue]: ") x = int(sXLocation) y = int(sYLocation) if sColor == "1": pointer.color("red") else: pointer.color("blue") pointer.down() pointer.goto(x,y) pointer.up() #Close the graphic window on user's click screen.exitonclick()