
PyGame: Primitives
Presentation
•
Computers
•
12th Grade
•
Practice Problem
•
Medium
Аңсар Әкім
Used 41+ times
FREE Resource
7 Slides • 10 Questions
1
Graphic primitives. |
Assessment Criteria:
Remember (Knowledge):
Identify the Pygame functions for drawing basic graphic primitives.
List the parameters required to draw a rectangle or circle.
Understand (Comprehension):
Explain the purpose and use of Pygame's drawing functions.
Describe how coordinates and dimensions are used to position and size graphic primitives on the window.
Apply (Application):
Demonstrate the ability to draw rectangles and circles on the Pygame window.
Adjust the parameters to create variations in size, position, and color.
Analyze (Analysis):
Analyze the impact of different parameters on the appearance of graphic primitives.
Identify and troubleshoot common errors in drawing graphic primitives.
2
Word Cloud
Pygame library
3
Multiple Choice
What function is used to initialize Pygame?
4
Multiple Choice
How do you create a Pygame window of dimensions 800x600 pixels?
window = pygame.create_window(800, 600)
window = pygame.Window(800, 600)
window = pygame.display.create_window(800, 600)
window = pygame.display.set_mode((800, 600))
5
Multiple Choice
What is the purpose of the Pygame main loop?
To initialize the game
To handle user events
To draw graphics on the screen
All of the above
6
Multiple Choice
How do you handle the quit event in the Pygame main loop?
if event.type == pygame.QUIT: pygame.end()
if event.type == pygame.EXIT: pygame.quit()
if event == pygame.QUIT: sys.exit()
d. if event.type == QUIT: pygame.quit()
7
Graphic primitives. |
Assessment Criteria:
Remember (Knowledge):
Identify the Pygame functions for drawing basic graphic primitives.
List the parameters required to draw a rectangle or circle.
Understand (Comprehension):
Explain the purpose and use of Pygame's drawing functions.
Describe how coordinates and dimensions are used to position and size graphic primitives on the window.
Apply (Application):
Demonstrate the ability to draw rectangles and circles on the Pygame window.
Adjust the parameters to create variations in size, position, and color.
Analyze (Analysis):
Analyze the impact of different parameters on the appearance of graphic primitives.
Identify and troubleshoot common errors in drawing graphic primitives.
8
Drawing a Rectangle Online compiler Trinket
# Draw a red rectangle
rect_color = (255, 0, 0)
rect_dimensions = pygame.Rect(50, 50, 100, 75)
pygame.draw.rect(screen, rect_color, rect_dimensions)
Rectangle https://trinket.io/pygame/b16a964027
Circle https://trinket.io/pygame/c770ca8d10
9
Drawing a Polygon Online compiler Trinket
# Define the points for the polygon (vertices)
polygon_points = [(200, 100), (300, 50), (400, 100), (300, 200)]
# Set colors
BLACK = (0, 0, 0)
GREEN = (0, 255, 0)
# Draw the polygon
pygame.draw.polygon(screen, GREEN, polygon_points)
https://trinket.io/pygame/6a602a4a52
10
Multiple Choice
How do you draw a rectangle in Pygame?
pygame.draw.rect(surface, color, dimensions)
pygame.draw.rectangle(surface, color, dimensions)
pygame.draw.square(surface, color, dimensions)
pygame.draw.rect(surface, dimensions, color)
11
Multiple Choice
What Pygame function is used to draw a polygon?
pygame.draw.polygon(surface, color, vertices)
pygame.draw.poly(surface, color, vertices)
pygame.draw.draw_polygon(surface, color, vertices)
pygame.draw.shape(surface, color, vertices)
12
Draw
Let's create some simple drawings.
Be creative, use different colours and graphical primitives: rectangle, line, polygon and circle.
13
It's time to recreate your drawing within Pygame
Create similar drawing as in the previous task programmatically
14
Graphic primitives.
Use the random library to change the colours and parameters of the primitives
Add movement within the main loop.
Example: https://trinket.io/pygame/0048ec3598
15
Poll
Practical tasks
1-2
3-5
6-7
8-9
16
Graphic primitives. |
Assessment Criteria:
Remember (Knowledge):
Identify the Pygame functions for drawing basic graphic primitives.
List the parameters required to draw a rectangle or circle.
Understand (Comprehension):
Explain the purpose and use of Pygame's drawing functions.
Describe how coordinates and dimensions are used to position and size graphic primitives on the window.
Apply (Application):
Demonstrate the ability to draw rectangles and circles on the Pygame window.
Adjust the parameters to create variations in size, position, and color.
Analyze (Analysis):
Analyze the impact of different parameters on the appearance of graphic primitives.
Identify and troubleshoot common errors in drawing graphic primitives.
17
Open Ended
Feedback
Graphic primitives. |
Assessment Criteria:
Remember (Knowledge):
Identify the Pygame functions for drawing basic graphic primitives.
List the parameters required to draw a rectangle or circle.
Understand (Comprehension):
Explain the purpose and use of Pygame's drawing functions.
Describe how coordinates and dimensions are used to position and size graphic primitives on the window.
Apply (Application):
Demonstrate the ability to draw rectangles and circles on the Pygame window.
Adjust the parameters to create variations in size, position, and color.
Analyze (Analysis):
Analyze the impact of different parameters on the appearance of graphic primitives.
Identify and troubleshoot common errors in drawing graphic primitives.
Show answer
Auto Play
Slide 1 / 17
SLIDE
Similar Resources on Wayground
12 questions
Sassafras Chemistry Chapter 2
Presentation
•
12th Grade
13 questions
IB Biology 2016 Syllabus Topic 2.9 S1
Presentation
•
12th Grade
12 questions
Quizizz
Presentation
•
12th Grade
9 questions
ICT SKILLS chapter 1
Presentation
•
12th Grade
11 questions
Population Ecology
Presentation
•
12th Grade
15 questions
REVIEW FOR ONLINE TEST UNIT 4 3RD GRADE
Presentation
•
11th - 12th Grade
14 questions
Repaso: Gustar + Verbos
Presentation
•
12th Grade
13 questions
El tiempo y la ropa practice
Presentation
•
12th Grade
Popular Resources on Wayground
6 questions
PRIDE Always and Everywhere
Presentation
•
12th Grade
20 questions
Lab Safety Quiz
Quiz
•
6th Grade
26 questions
KOR Review Kahoot Questions
Quiz
•
8th Grade
21 questions
Continents and Oceans
Quiz
•
6th Grade
12 questions
Unit Zero lesson 2 cafeteria
Presentation
•
9th - 12th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade
10 questions
Riddles Riddles fun Riddles
Quiz
•
6th - 12th Grade
16 questions
Subject & Predicate
Quiz
•
5th Grade