import turtle as t |
#红色的旗面 |
def flag(x,y): |
t.up() |
t.goto(x,y) |
t.down() |
t.color( "red" ) |
t.begin_fill() |
for i in range ( 4 ): |
if i % 2 = = 0 : |
t.forward( 300 ) |
else : |
t.forward( 200 ) |
t.left( 90 ) |
t.end_fill() |
def star(x): |
t.color( "yellow" ) |
t.begin_fill() |
for i in range ( 5 ): |
t.forward(x) |
t.right( 144 ) |
t.end_fill() |
#黄色的大五角星 |
def bigstar(x,y): |
t.up() |
t.goto(x,y) |
t.down() |
star( 35 ) |
#四个小五角星 |
def littlestar(x,y,single): |
'''single 代表小五角星旋转的角度,以保证小五角星的一个角正对大五角星中心''' |
t.up() |
t.goto(x,y) |
t.left(single) |
t.down() |
star( 14 ) |
#主程序 |
flag( - 150 , - 100 ) |
bigstar( - 130 , 60 ) |
littlestar( - 60 , 75 , 30 ) |
littlestar( - 40 , 50 , 60 ) |
littlestar( - 38 , 22 , 30 ) |
littlestar( - 50 , 8 , 60 ) |
t.hideturtle() |
t.done() |
|