Script
#!/usr/local/bin/python3.7
import turtle
def report_position(x,y):
print("x = ", x, " y = ", y, flush=True)
turtle.onscreenclick(report_position)
turtle.mainloop()
print()
Execution
Click the mouse anywhere inside the window, and the program prints out the X and Y co-ordinates.
#!/usr/local/bin/python3.7
import turtle
def report_position(x,y):
print("x = ", x, " y = ", y, flush=True)
turtle.onscreenclick(report_position)
turtle.mainloop()
print()
Execution
Click the mouse anywhere inside the window, and the program prints out the X and Y co-ordinates.
No comments:
Post a Comment