小言_互联网的博客

Python---turtle模块---zhai po ni zi国旗的绘画

445人阅读  评论(0)

(本篇博主自己编写,如有帮助,甚是荣幸!!)

#-*-coding:utf-8-*-

Python--日本国旗Python--日本国旗Python--日本国旗Python--日本国旗Python--日本国旗Python--日本国旗Python--日本国旗Python--日本国旗

#Japan(RiBen)

import turtle

import math

def draw_circle(aTurtle):

    aTurtle.begin_fill()

    aTurtle.fillcolor('red')

    aTurtle.penup()

    aTurtle.goto(5,-100)

    aTurtle.pendown()

    aTurtle.begin_fill()

    aTurtle.fillcolor('red')

    aTurtle.circle(100,360)  

    aTurtle.end_fill()

def draw_qi(times=20.0):                

    width, height = 30*times, 20*times

 

    window = turtle.Screen()

    aTurtle = turtle.Turtle()

    aTurtle.hideturtle()

    aTurtle.speed(10)

 

    aTurtle.penup()

    aTurtle.goto(-width/2, height/2)

    aTurtle.pendown()

    aTurtle.begin_fill()

    aTurtle.fillcolor('white')

    aTurtle.fd(width)

    aTurtle.right(90)

    aTurtle.fd(height)

    aTurtle.right(90)

    aTurtle.fd(width)

    aTurtle.right(90)

    aTurtle.fd(height)

    aTurtle.right(90)   

    aTurtle.end_fill() 

    draw_circle(aTurtle)

    window.exitonclick()

if __name__=='__main__':

    draw_qi()    

(如有更好代码请一定指教!如有不懂,留言有空必答!!)


转载:https://blog.csdn.net/guoyihaoguoyihao/article/details/89141501
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场