python 画几何图形

# 多边形的画法
def ployon(num, distance):
#     bob.color('blue', 'red')
    bob.color("red", "yellow") 
    for i in range(num):
        bob.fd(distance)
        bob.lt(360 / num)
        time.sleep(1) 
    bob.end_fill()
    bob.filling()
    time.sleep(3)
    bob.reset()


# ployon(3, 100)
# ployon(4, 100)
# ployon(5, 100)
# ployon(6, 100)
# ployon(7, 100)
# ployon(8, 100)


# # 五角星的画法
# bob.color("red", "yellow") 
# for i in range(5):
#     bob.fd(200)
#     bob.right(180 - 36)
#     time.sleep(0.5)
# bob.end_fill()
#  
# bob.reset()

# # 八角星
# bob.color("red", "yellow") 
# for i in range(8):
#     bob.fd(200)
#     bob.right(180 - 45)
#     time.sleep(0.5)
# time.sleep(10)

# bob.reset()


# 六角星
# bob.color("red", "yellow") 
# for i in range(3):
#     bob.fd(200)
#     bob.right(180 - 60)
#     time.sleep(0.5)
#     
# bob.up()   
# bob.lt(30)
# bob.fd(200 / math.sqrt(3))
# bob.rt(90)
# bob.down()

# for i in range(3):
#     bob.fd(200)
#     bob.right(180 - 60)
#     time.sleep(0.5)
# time.sleep(2)

# bob.reset()




# 迷宫的画法
def squareSpiral(ra):
    bob.pencolor("green")
    for x in range(100):
        bob.forward(x)
        bob.left(ra)
    time.sleep(3)
    bob.reset()




def circleSpiral(ra):
    bob.pencolor("green")
    for x in range(100):
        bob.circle(x)
        bob.left(ra)
    time.sleep(3)
    bob.reset()


# 迷宫
# squareSpiral(90)
# # 大风车
# squareSpiral(91)
# # 漩涡
# circleSpiral(90)


# 花朵
# circleSpiral(60)


def circleSpiral2(ra):
    bob.pencolor("green")
    a = 0;
    n = 360 / ra
    while(a + 1 <= n):
        bob.circle(50)
        bob.left(ra)
        a = a + 1
    time.sleep(3)
    bob.reset()
  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

大巨魔战将

如果对您有帮助,请打赏1分钱

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值