栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

有趣的python系列一:代码实现酷炫的彩虹

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

有趣的python系列一:代码实现酷炫的彩虹

效果是动态的!

from turtle import *
 
colors = ["red", "yellow", "blue", "lime"]
bgcolor("black")
 
x = 6
t = [Turtle(), Turtle()]
 
for index, i in enumerate(t):
	i.speed(0)
	i.color("white")
	i.shape("circle")
	i.shapesize(0.3)
	i.width(3)
	i.pu()
	i.seth(90)
	i.fd(350)
	i.seth(-180)
	i.pd()
t[0].pu()
delay(0)
speed(0)
ht()
for i in colors:
	color(i)
	for i in range(360):
		t[0].fd(x)
		t[0].lt(1)
		pu()
		goto(t[0].pos())
		pd()
		t[1].fd(2 * x)
		t[1].lt(2)
		goto(t[1].pos())
done()

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/879191.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号