Python小程序之五星红旗

# -*- coding: UTF-8 -*-

import turtle

turtle.setup(700,500,0,0)
turtle.color('yellow')
turtle.bgcolor('red')
turtle.fillcolor('yellow')

def mygoto(x,y):
    turtle.up()
    turtle.goto(x,y)
    turtle.down()

def draw(z):
    turtle.begin_fill()
    for i in range(5):
        turtle.forward(z)
        turtle.right(144)
    turtle.end_fill()

mygoto(-300,130)
draw(100)
mygoto(-170,220)
draw(50)
mygoto(-130,160)
draw(50)
mygoto(-140,80)
draw(50)
mygoto(-170,10)
draw(50)

turtle.done()

运行结果截图:

posted @ 2018-03-14 18:20  050朱小彬  阅读(467)  评论(0编辑  收藏  举报