Class Programs and Activities

Mouse input

1. Write a program to create a window. (Draw something in the window or leave it blank. It is not required for this step.)

  1. click the mouse in the window
  2. print the mouse's coordinates on the terminal
  3. loop (rinse and repeat)

Select an area on the window to be the "exit" coordinates. Exit the program if the mouse is clicked in this area. For example:

if mouseX < 50 and mouseY < 50:
    Exit the program

2. What is the difference between "getMouse()" and "checkMouse()".

3. Draw a circle or other graphics object in the window. Move the object to where the mouse is clicked.