мой вопрос - есть ли модуль, который позволяет мне выскакивать в pygame, показывать изображение в течение 5 секунд и закрываться сразу после того, как мне ничего не нужно делать?После закрытия он должен вернуться к pycharm и запустить там код.
Я пытался сделать time.sleep(5)
, а затем pygame.quit()
без удачи.
мой код:
import pygame
def messageToScreen(msg, color, x, y):
font = pygame.font.Font("Chain Breaker - Free Personal Use.ttf", 23)
screen_text = font.render(msg, True, color)
gameDisplay.blit(screen_text, [x, y])
pygame.display.update()
pygame.init()
blue = (152, 245, 255)
black = (0, 0, 0)
red = (255, 0, 0)
yellow = (255, 215, 0)
darkblue = (0, 0, 255)
gameDisplay = pygame.display.set_mode((800, 600))
pygame.display.set_caption("Fairy Tale Title")
gameExit = False
while not gameExit:
for event in pygame.event.get():
if event.type == pygame.QUIT:
gameExit = True
title = pygame.image.load("book.jpeg")
screen = pygame.display.set_mode((0, 0))
screen.blit(title, (0, 0))
messageToScreen("You are meant for the ", darkblue, 100, 100)
messageToScreen("FAIRY TALE UNIVERSE", darkblue, 150, 200)
messageToScreen("But before you proceed you must", darkblue, 200, 300)
messageToScreen("take the aptitude test. ", darkblue, 250, 400)
pygame.display.update()
pygame.quit()
quit()
я пытался выполнить time.sleep (5), прежде чем выйти, но он не работает