看图编函数练习Python小蓝伞circle命令运用

0 Comments

Python看图练习编程circle伞

Python看图练习编程circle伞
看图画伞,一个顺序结构的案例。以下是参考代码:

from turtle import Screen,Turtle

def draw_12(x,y,size):
    """画伞 colored umbrella"""
    size2 = size/2
    size3 = size/3
    size6 = size/6
    penup()
    pensize(2)
    pencolor('blue')
    goto(x,y)
    setheading(0)
    pendown()
    fillcolor('cyan')
    begin_fill()
    circle(-size6,90)
    right(180)
    circle(-size6,180)
    right(180)
    circle(size/2,180)
    right(180)
    circle(-size6,180)
    right(180)
    circle(-size6,90)
    end_fill()
    right(90)
    color('brown')
    fd(size/1.5)
    circle(size/10,180)    
    pensize(1)
    penup()
    goto(x,y)
    setheading(0)

speed(0)        
draw_12(0,0,150)
 

就等你了, 成为本人会员可获得最大的技术支持噢。

标签:

发表评论