/
Lab7.py
59 lines (48 loc) · 1.34 KB
/
Lab7.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
def drawX(my_turtle):
my_turtle.up()
my_turtle.setposition(-400,300)
my_turtle.down()
my_turtle.setposition(400,-300)
my_turtle.up()
my_turtle.setposition(400,300)
my_turtle.down()
my_turtle.setposition(-400,-300)
def drawW(my_turtle):
my_turtle.up()
my_turtle.setposition(-100,0)
my_turtle.down()
my_turtle.right(45)
for i in range (0,2):
my_turtle.forward(70.7106781187)
my_turtle.left(90)
my_turtle.forward(70.7106781187)
my_turtle.right(90)
def movingTurtle(my_turtle):
my_turtle.up()
my_turtle.setposition(0, -300)
turtle.resizemode('user')
stretch_wid = 20
stretch_len = 20
my_turtle.setheading(90)
my_turtle.shapesize(stretch_wid, stretch_len)
while my_turtle.ycor() < (300):
my_turtle.forward(15)
my_turtle.shapesize(stretch_wid,stretch_len)
stretch_wid = stretch_wid - .5
stretch_len = stretch_len - .5
import turtle
def main():
# set window size
screen_width = 800
screen_height = 600
turtle.setup(screen_width,screen_height)
# get reference to turtle window
window = turtle.Screen()
# set window title bar
window.title('Lab 7')
my_turtle = turtle.getturtle()
drawX(my_turtle)
drawW(my_turtle)
movingTurtle(my_turtle)
turtle.exitonclick()
main()