
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
Zander and Sons
Presentation
•
KG
12 questions
Unit 5 A healthy body
Presentation
•
KG
11 questions
P1E Math
Presentation
•
KG
10 questions
Exercise K-1
Presentation
•
KG
15 questions
Binary Search 2
Presentation
•
11th - 12th Grade
12 questions
Interfaz Gráfica de Usuario
Presentation
•
University
12 questions
U6L4 - Lecture Notes - Molecular Shapes
Presentation
•
12th Grade
13 questions
Renaissance Background
Presentation
•
12th Grade
Popular Resources on Wayground
20 questions
"What is the question asking??" Grades 3-5
Quiz
•
1st - 5th Grade
20 questions
“What is the question asking??” Grades 6-8
Quiz
•
6th - 8th Grade
10 questions
Fire Safety Quiz
Quiz
•
12th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
34 questions
STAAR Review 6th - 8th grade Reading Part 1
Quiz
•
6th - 8th Grade
20 questions
“What is the question asking??” English I-II
Quiz
•
9th - 12th Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
47 questions
8th Grade Reading STAAR Ultimate Review!
Quiz
•
8th Grade
Discover more resources for Computers
10 questions
Fire Safety Quiz
Quiz
•
12th Grade
20 questions
“What is the question asking??” English I-II
Quiz
•
9th - 12th Grade
10 questions
Fire Prevention
Quiz
•
9th - 12th Grade
20 questions
Grammar
Quiz
•
9th - 12th Grade
16 questions
AP Biology: Unit 1 Review (CED)
Quiz
•
9th - 12th Grade
20 questions
verbos reflexivos en español
Quiz
•
9th - 12th Grade
11 questions
Expectations Review
Quiz
•
9th - 12th Grade
10 questions
Climate Change and Its Impact
Interactive video
•
9th - 12th Grade