
CMU CS Python Rectangles, Colors and borders.
Presentation
•
Computers
•
9th - 12th Grade
•
Easy
Maria Cruz Farooqi
Used 2+ times
FREE Resource
4 Slides • 11 Questions
1
CMU CS Academy
Replace this with a sub-header that can be in multiple lines.
Duplicate this text as many times as you would like.
2
The Canvas
To understand what is going on, we first have to talk about the canvas. In this course, all drawing is done on a canvas.
The canvas is made up of tiny colored points, or pixels. We use (x,y) coordinates to talk about pixels on the canvas, like so:
(0, 0) is the left-top corner of the canvas (not the middle!).
As x increases, you head right.
As y increases, you head down, not up!
Our canvas is a 400 x 400 square, so (200, 200) is the middle of the canvas, and (400, 400) is the right-bottom corner.
3
As x increases, you head right.
As y increases, you head down, not up!
Our canvas is a 400 x 400 square, so (200, 200) is the middle of the canvas, and (400, 400) is the right-bottom corner.
(200, 200)
(400, 400)
4
Multiple Choice
Which one is near (0, 0) ?
A
B
C
D
5
Multiple Choice
Which one is near (400, 0) ?
A
B
C
D
6
Multiple Choice
Which one is near (400, 200) ?
A
B
C
D
7
Multiple Choice
Which one is near (400, 400) ?
A
B
C
D
8
Python is very picky. Here are some rules to follow:
Case matters, so Rect is not the same as rect.
A command must have the right number of values after it.
For Rect, that's left, top, width, and height. These values are called arguments. Here are some rules about arguments:
They must be in the right order.
They must be inside parentheses.
They must be separated by commas.
If any of these rules are not followed, you have an error, and your code will not run correctly until you fix the error.
9
Drag and Drop
10
Drag and Drop
Rect (0,200,100,200)
Rect (200,200, 200,200)
11
Drag and Drop
12
Multiple Choice
The order in which we draw shapes matters. Each new shape is drawn on top of all the previous shapes. Which code is in the correct order?
Rect(0, 0, 100, 100, fill='orange')
Rect(50, 50, 100, 100, fill='lime')
Rect(50, 50, 100, 100, fill='lime')
Rect(0, 0, 100, 100, fill='orange')
13
Multiple Choice
The order in which we draw shapes matters. Each new shape is drawn on top of all the previous shapes. Which code is in the correct order?
Rect (40,20,160,160, fill="dodgerBlue")
Rect(120,100,160,200, fill="lightGreen")
Rect (200,220,160,160, fill="dodgerBlue")
Rect(0,0,400,400,fill="lightSalmon")
Rect(0,0,400,400,fill="lightSalmon")
Rect (40,20,160,160, fill="dodgerBlue")
Rect(120,100,160,200, fill="lightGreen")
Rect (200,220,160,160, fill="dodgerBlue")
14
Drag and Drop
15
Dropdown
CMU CS Academy
Replace this with a sub-header that can be in multiple lines.
Duplicate this text as many times as you would like.
Show answer
Auto Play
Slide 1 / 15
SLIDE
Similar Resources on Wayground
13 questions
Simple and Compound Interest
Presentation
•
9th - 12th Grade
8 questions
Quizizz Information Session
Presentation
•
9th - 12th Grade
10 questions
Hispanic Heritage Month
Presentation
•
10th - 12th Grade
12 questions
Chap 4 Word 4.7 Illustrations
Presentation
•
9th - 12th Grade
13 questions
Newton's Second Law
Presentation
•
9th - 12th Grade
12 questions
Empirical Rule
Presentation
•
10th - 12th Grade
16 questions
Computer Science Principles Unit 3 Review
Presentation
•
9th - 12th Grade
13 questions
Klasno i besklasno adresiranje
Presentation
•
9th - 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