机器学习爱好者

turtle模块

2019-02-13  本文已影响8人  陨星落云
def draw_square(some_turtle):
    #循环
    for i in range(1,5):
        some_turtle.forward(100)
        some_turtle.right(90)
      
def draw_art():
    window=turtle.Screen()#创建窗口
    window.bgcolor("yellow")
    #
    brad = turtle.Turtle()#创建实例
    brad.shape("arrow")#形状(turtle、square、arrow、circle)
    brad.color("green")#颜色
    brad.speed(10)#速度
    for i in range(1,37):
        draw_square(brad)
        brad.right(10)
    #
    angie=turtle.Turtle()
    angie.shape("circle")
    angie.color("blue")
    angie.circle(100)
draw_art()
QQ截图20190213190553.jpg
上一篇下一篇

猜你喜欢

热点阅读