Advanced Graphics - Activity
Advanced Graphics - Activity
Advanced Graphics - Activity
In the Python editor, type in the small program (or copy and paste it) in the first column of the
table. When typing these programs, be very careful to type exactly what is shown.
Copy and paste (screenshot) what the program displays - the output of the program - into the
second column of the table. Enter any notes you want to add as well. Then erase the program
you typed and type in the next.
There is no need to save these programs but save the document with the output and your
notes.
When you have completed this section fill in the blanks in the section notes at the end of the
document. After submitting, check your answers against the provided solution.
Programming Graphics
from graphics import * Look at the top left to see the dot.
Change the first number a few times. Where does the dot
move to? Thinking of the computer screen as an x-y
graph in math class, does the first number represent x or
The x axis is represented by the
y (horizontal or vertical)?
first 20 in the code, (x,y). As you
can see in this picture.
“myLine=Line(Point(200,0),Point(
43,70));”
I just started at 200 and just
removed 100 from the 143.
“myLine=Line(Point(0,100),Point(
200,100));” I just put x to 0 and y
to 100 to make it in the center and
did 200 and 100 on the other axis
to make a horizontal line.
Change the 4 numbers, so the line is vertical down the
screen. Record the coordinates you used -->
“myLine=Line(Point(100,200),Poin
t(100,0));” I just put the x axis at
the 100 which is the middle, the y
axis at 200 but just 1 y axis.
Add the line r.undraw() to the program after the sleep This affected the whole picture. It
command and explain the effect. removed the rest of the rectangles
and you can only see 1 rectangle
drifting across the graphic screen
rather than having all of them
slide together. Its like you had
terrible wifi to top of the line.
Change the by 5 to by 20, what effect did it have? The single rectangle almost
quadruples it speed so it gets
across the screen faster skipping
20 pixels each time.
Change the sleep(.1) to sleep(1), what effect did it have? This decreased the speed of the
rectangle because there is now a
1 second delay before every
move.
for i in range(1,20):
r.move(20,20)
time.sleep(.1);