lab6.py
. I've prepared
a starter file for you, available here on
the course webpage.
Late penalties: 1 day late: -5%, 2 days: -10%, -3 days: -20%.
To turn your work in, go
to
mycourses.unh.edu
,
find CS414, open the syllabus, and click on Lab 6. Then click
Submit Assignment, click Choose file, and
find lab6.py
.
turtle
module, write a python program
that draws the following scene:
goto(10, 20) |
Moves the pen to position (10, 20) |
setpos(10, 20) |
Moves the pen to position (10,20), same
as goto |
forward(100) |
Moves the pen forward 100 units |
fd(100) |
Moves the pen forward 100 units, same
as forward |
setheading(90) |
'forward' is now up (0 = right, 90 = up, 180 = left, 270 = down) |
right(90) |
rotates the heading 90 degrees to the right |
rt(90) |
rotates the heading 90 degrees to the right, same
as right |
left(90) |
rotates the heading 90 degrees to the left |
lt(90) |
rotates the heading 90 degrees to the left, same
as left |
penup() |
Pen movement won't do any drawing |
pendown() |
Pen movement will draw something |
color('red') |
Lines will be drawn red, from here on |
pensize(5) |
Lines be drawn 5 pixels thick, from here on |
begin_fill() |
Start a filled polygon |
end_fill() |
Finish a filled polygon |
fillcolor('yellow') |
Polygons will be filled with yellow pixels |
tracer(True) |
Show the pen's movements |
tracer(False) |
Don't show the pen's movements (draws much faster) |