红灯检测动画
from pygame import *
from sys import *init()
font.init()screen = display.set_mode((680,742))
display.set_caption("红灯检测")x=0
y=642
is_green = True
n = 300print(60*60*365*100)while True:for a in event.get():if a.type == QUIT:quit()exit() screen.blit(image.load("操场.png"),(0,0))b = image.load("汽车.png").convert()b.set_colorkey((255,255,255))for a in range(3):screen.blit(b,(x+100*a,y))if is_green:screen.blit(image.load("红绿灯.png"),(340,0))else:screen.blit(image.load("红绿灯-副本(1).png"),(340,0))screen.blit(font.SysFont("simhei",50).render(str(n//30),0,(255,255,255)),(436,85))if is_green:x += 10else:x = 0if x > 680: x = 0 if n == 0 and is_green:is_green = Falsen = 300elif n == 0 and is_green == False :is_green = Truen = 300n -= 1time.Clock().tick(30)display.flip()
总结
- 上一篇: [RealSense]2-实感摄像头与S
- 下一篇: 【重磅】世界区块链组织首席科学家白硕:区