码迷,mamicode.com
首页 > 编程语言 > 详细

Python基础综合练习

时间:2018-03-20 15:53:03      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:got   python   goto   bubuko   star   tle   forward   pos   yellow   

import turtle

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

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

turtle.setup(600, 400, 0, 0)
turtle.color("yellow")
turtle.bgcolor(‘red‘)

mygoto(-250, 110)
drawstar(100)

for i in range(4):
    x=1
    if i in [0, 3]:
        x=0
    mygoto(-130+x*40, 150-i*45)
    turtle.left(15-i*15)
    drawstar(30)

turtle.done()

  技术分享图片

Python基础综合练习

标签:got   python   goto   bubuko   star   tle   forward   pos   yellow   

原文地址:https://www.cnblogs.com/Lorz/p/8609617.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!