python基础

import turtle

#设置画笔和背景的颜色
turtle.color('yellow')
turtle.bgcolor('red')

#嵌套函数
def drawfivestars(row,colum,size):
    def move(x,y):
        turtle.up()
        turtle.goto(x,y)
        turtle.down()
    def drawstar(thissize):
        for i in range(5):
            turtle.left(144)
            turtle.back(thissize)
    turtle.begin_fill()
    move(row,colum)
    drawstar(size)
    turtle.speed(0)
    turtle.end_fill()
drawfivestars(-330, 160, 100)
drawfivestars(-170, 260, 50)
drawfivestars(-130, 190, 50)
drawfivestars(-155, 110, 50)
drawfivestars(-210, 40, 50)
#不关闭窗口
turtle.done()

 

posted @ 2018-03-15 20:38  kaiwenxiao  阅读(102)  评论(0编辑  收藏  举报