代码改变世界

python基础

2018-03-14 23:06  Molemole  阅读(327)  评论(0编辑  收藏  举报
# -*- coding:UTF-8 -*-
# -*- author: Hiro -*-
import turtle
from turtle import *


turtle.setup(600,400,0,0)
turtle.bgcolor('red')
turtle.color('yellow')
turtle.fillcolor('yellow')
def mygoto(x,y):
    turtle.up()
    turtle.goto(x,y)
    turtle.down()

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




mygoto(-250,120)
draw(90)
mygoto(-135,170)
draw(25)
mygoto(-100,140)
draw(25)
mygoto(-110,95)
draw(25)
mygoto(-135,60)
draw(25)
turtle.done()

运行结果截图: