夜幕下的霓虹_闪烁版
2月 15, 2020
0 Comments

在海龟画图屏幕上打几个彩色的点点,这很多学过Python的人都会。可是如何让这些点点都闪烁起来,该如何编程呢?秘密就在本源代码,以下是部分代码预览,它完成了打静态彩点的任务。
from random import * from turtle import * from time import sleep cs = ['red','orange','yellow','green', 'cyan','blue','purple','pink','magenta'] screen = Screen() screen.setup(800,600) screen.bgcolor('black') screen.title('夜幕下的霓虹_闪烁版') screen.tracer(0,0) tom = Turtle(visible=False) tom.penup() for _ in range(100): x = randint(-400,400) y = randint(-300,300) tom.goto(x,y) c = choice(cs) tom.color(c) tom.dot(20) pass
# 把下面隐藏的代码接上,彩色点点就能闪烁起来了!几块钱的小意思,省去你大量探索的时间,确实是高性价比呀。
需要浏览更多吗?
成为会员后,登陆才能继续浏览!联系微信scratch8即可办理会员。
(会员专属:能浏览所有文章,下载所有带链接的Python资源。)