Python基础(红旗)

# -*- coding: UTF-8 -*-
# -*- author: yjw -*-

import turtle
from turtle import *

setup(800,600)
color("yellow")
fillcolor("yellow")
bgcolor("red")
def mygoto(x,y):
    up()
    goto(x,y)
    down()

def drawstarFW(x):
    begin_fill()
    for i in range(5):
        forward(x)
        right(144)
    end_fill()

def drawstarRight(x):
    begin_fill()
    for i in range(5):
        forward(30)
        right(x)
    end_fill()

def drawstarLeft(x):
    begin_fill()
    for i in range(5):
        forward(30)
        left(x)
    end_fill()

mygoto(-330,180)
drawstarFW(100)

mygoto(-210,220)
drawstarLeft(144)

mygoto(-180,180)
drawstarLeft(144)

mygoto(-190,140)
drawstarRight(144)

mygoto(-220,90)
drawstarLeft(144)
done()

posted @ 2018-03-15 20:53  150颜杰文  阅读(202)  评论(0编辑  收藏  举报