该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
import pygame,sys
from pygame.locals import *
import time
pygame.init()
screen = pygame.display.set_mode((300, 450), 0, 32)
background = pygame.image.load('11.png').convert()
screen.blit(background, (0,0))
times =30
while True:
for event in pygame.event.get():
if event.type==pygame.QUIT:
sys.exit()
while times != 0:
for event in pygame.event.get():
if event.type==KEYDOWN:
if event.key == K_SPACE:
times = 31
time.sleep (1)
times =times - 1
if times == 0 :
times =30
if times >=10:
m = 100
else :
m = 180
text = str ( times)
my_font = pygame.font.SysFont("arial", m)
nr = my_font.render(text, True, (0,0,0), (255, 255, 255))
screen.blit(nr, (120,230))
pygame.display.update()
这段代码初步可以实现要求,但是还是有很多BUG。。有没有大神帮忙修改修改。