
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
16 questions
SQL - Data types
Presentation
•
12th Grade
10 questions
Array Concepts using JAVA
Presentation
•
University
14 questions
Mastering CCNA: Interfaces and Cables
Presentation
•
University
12 questions
Draw
Presentation
•
12th Grade
10 questions
Lecture 1 - part 2 - CIS430
Presentation
•
University
10 questions
Lesson 1
Presentation
•
11th Grade - University
10 questions
K.3 Safety in My Online Neighborhood
Presentation
•
KG
9 questions
การสร้างเว๊บไซต์1_64 สัปดาห์ที่ 4
Presentation
•
12th Grade
Popular Resources on Wayground
24 questions
PBIS-HGMS Day 10
Quiz
•
6th - 8th Grade
10 questions
HCS SCI 03 Summer School Review 3
Quiz
•
3rd Grade
11 questions
Home Scope
Quiz
•
7th - 8th Grade
15 questions
HCS SCI 05 Summer School Assessment 3 Review
Quiz
•
5th Grade
35 questions
Lufkin Road Middle School Student Handbook & Policies Assessment
Quiz
•
7th Grade
18 questions
Geo 11.3 Area of Circles and Sectors
Quiz
•
9th - 11th Grade