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

Python基础综合练习

时间:2018-03-19 13:39:25      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:.com   综合   yellow   goto   forward   set   src   image   port   

import turtle


def drawFivePointedStar(x,y,width,degree):
    turtle.up()
    turtle.goto(x,y)
    turtle.down()
    turtle.begin_fill()
    turtle.setheading(degree)
    for i in range (5):    
        turtle.forward(width)
        turtle.right(144)
    turtle.end_fill()

turtle.bgcolor("red")
turtle.fillcolor("yellow")
turtle.color(yellow)

#主星
drawFivePointedStar(-300,220,150,0)

#副星
drawFivePointedStar(-100,295,50,305)
drawFivePointedStar(-50,212,50,30)
drawFivePointedStar(-50,145,50,5)
drawFivePointedStar(-100,90,50,300)

turtle.done()

技术分享图片

 

Python基础综合练习

标签:.com   综合   yellow   goto   forward   set   src   image   port   

原文地址:https://www.cnblogs.com/hehe2333/p/8601023.html

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