Week 3 - Canvas, drawing, timers discussion#

Goals#

  • Create a canvas in Python

  • Learn how to draw on the canvas

  • Create a digital stopwatch

Week 3a - Drawing Canvas#

Canvas and Drawing#

  1. How are the small components of a computer screen called that can have a specific color?

  1. What is a frame buffer?

  1. What is a refresh rate?

  1. Typically GUI applications call a function to refresh the image shown on your monitor. How is this function called?

  1. What is the coordinate of the following pixel?

    . 0 1 2 3 4
    0
    1     X
    2
    3
    4
    

Interesting: Why is the origin in computer graphics coordinates at the top left?

  1. The input handler function takes the value which was input as an argument. What does the draw handler function take as an argument?

String Processing#

  1. How can you combine strings?

  1. How can you combine strings and variables?

  1. What are slices?

  1. What does a negative number mean in the slicing notation?

  1. How many characters does string[:10] have?

Interactive drawing#

  1. Joe Warren mentions code folding in a sentence. What is it good for?

  1. What is the basic idea to draw the output of a function on the canvas?

Week 3b - Timers#

Timers#

  1. What are timers good for? Give an example.

  1. In the timer example code, Scott says that we do not update our canvas in the timer handler. Why?

  1. What would happen if we would put the code in draw() to tick() and vice versa?

Visualizing Drawing and Timers#

Programming Tips - 3#

Mini-project #3 - Stopwatch: The Game#