Chapter 05 Worksheet
Return to worksheet index.
Reminder: Please use full sentences, capital letters, and proper grammar
- Explain how the computer coordinate system differs from the standard Cartesian
coordinate system. There are two main differences. List both.
- Before a Python Pygame program can use any functions
like pygame.display.set_mode(), what two lines of code must occur first?
- Explain how WHITE = (255, 255, 255) represents a color.
- 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.)
- What does the pygame.display.set_mode() function do?
- What does this for event in pygame.event.get() loop do?
- What is pygame.time.Clock used for?
- For this line of code: (3 pts)
pygame.draw.line(screen, GREEN, [0, 0], [100, 100], 5)
- What does screen do?
- What does [0, 0] do?
- What does [100, 100] do?
- What does 5 do?
- What is the best way to repeat something over and over in a drawing?
- When drawing a rectangle, what happens if the specified line width is zero?
- Describe the ellipse drawn in the code below.
- What is the x, y of the origin coordinate?
- What does the origin coordinate specify? The center of the circle?
- What is the length and the width of the ellipse?
pygame.draw.ellipse(screen, BLACK, [20, 20, 250, 100], 2)
- When drawing an arc, what additional information is needed over drawing
- Describe, in general, what are the three steps needed when printing text to
the screen using graphics?
- 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.
- 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)
- What does pygame.display.flip() do?
- What does pygame.quit() do?
- 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.