Checkpoint 8.12.1.
- center of the canvas
- It is possible that it is drawn there, if that’s where the user clicks
- 100, 100
- It is possible that it is drawn there, if that’s where the user clicks
- It doesn’t - the ’here’ function is never called
- The message is in a listener function
- It depends on where the end user clicks
- Yes, because the code displaying the message is in a listener function that is called when the user clicks on the canvas
Where does the message get written on canvas?
import turtle
import random
def here(x, y):
alex.penup()
alex.goto(x, y)
alex.pendown()
alex.write("You are here!")
wn = turtle.Screen() # Set up the window and its attributes
alex = turtle.Turtle() # create alex
alex.goto(100, 100)
wn.onclick(here)
wn.listen()