Chapter 05 Worksheet

Return to worksheet index.

Reminder: Please use full sentences, capital letters, and proper grammar where appropriate.

  1. Explain how the computer coordinate system differs from the standard Cartesian coordinate system. There are two main differences. List both.
  2. Before a Python Pygame program can use any functions like pygame.display.set_mode(), what two lines of code must occur first?
  3. Explain how WHITE = (255, 255, 255) represents a color.
  4. When do we use variable names for colors in all upper-case, and when do we use variable names for colors in all lower-case? (This applies to all variables, not just colors.)
  5. What does the pygame.display.set_mode() function do?
  6. What does this for event in pygame.event.get() loop do?
  7. What is pygame.time.Clock used for?
  8. For this line of code: (3 pts)
    pygame.draw.line(screen, GREEN, [0, 0], [100, 100], 5)
    
  9. What is the best way to repeat something over and over in a drawing?
  10. When drawing a rectangle, what happens if the specified line width is zero?
  11. Describe the ellipse drawn in the code below.
    pygame.draw.ellipse(screen, BLACK, [20, 20, 250, 100], 2)
    
  12. When drawing an arc, what additional information is needed over drawing an ellipse?
  13. Describe, in general, what are the three steps needed when printing text to the screen using graphics?
  14. When drawing text, the first line of the three lines needed to draw text should actually be outside the main program loop. It should only run once at the start of the program. Why is this? You may need to ask.
  15. What are the coordinates of the polygon that the code below draws?
    pygame.draw.polygon(screen, BLACK, [[50,100],[0,200],[200,200],[100,50]], 5)
    
  16. What does pygame.display.flip() do?
  17. What does pygame.quit() do?
  18. Look up on-line how the pygame.draw.circle works. Get it working and paste a working sample here. I only need the one line of code that draws the circle, but make sure it is working by trying it out in a full working program.