VIRTUAL.WHITEBOARD

GOAL: Build a drawing program
SYNPOSIS: Individual project | Winter 2018 | Python
KEY SKILLS: Responding to mouse & keyboard input | GUI
VIDEO OF PROGRAM IN ACTION

Pressing different letters to change the pen's color. Video sped up 6x.

Key Process:

  1. Create global variables x_old, y_old and x_new, y_new and booleans to track whether the mouse is being clicked
  2. When the user moves the mouse, store the value mouse’s position into x_new, y_new
  3. If the user is both moving the mouse and holding it down, draw a line between x_old, y_old and x_new, y_new
  4. Once the line has been drawn, set the x_old, y_old values to equal the x_new, y_new values
  5. Set up the keyboard response system with a series of if statements. Depending on the letter pressed, change the color of the line being drawn between the 2 points