python画图之图斯幻象动图

# 导入模板
from turtle import *
from time import sleep
# 设置页面
setup(600, 600, 807, 117)
bgcolor('#08203D')
pensize(5)
pencolor('white')
ht()
colors = ['OrangeRed', 'DeepSkyBlue',
          'Gold', 'Turquoise', 'Purple',
          'Orange']

# 无痕移动画笔
def pen_goto(a, b):
    up()
    goto(a, b)
    down()

# 画大圆
def big_circle():
    pen_goto(0, -200)
    seth(0)
    circle(200)

# 画小圆
def small_circle():
    circle(100)

# 画小球球
def balls():
    for i in range(6):
        dot(30, colors[i])
        up()
        circle(100, 60)
        down()

# 画连接的线条
def lines():
    for i in range(6):
        up()
        home()
        left(30 * i)
        bk(200)
        down()
        fd(400)

# 设旋转
def spin(d):
    up()
    goto(0, -200)
    seth(0)
    circle(200, d * n)
    circle(100, -2 * d * n)
    down()

# 结束收尾
n = 0
try:
    while True:
        tracer(0)
        clear()
        big_circle()
        lines()
        spin(2)
        small_circle()
        balls()
        n += 1
        update()
        sleep(0.01)
except:
    print('Exit')

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值