pyinstaller:pygame窗口未打开

2024-04-27 20:15:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我在windows上使用python3.8。我正在尝试用pyinstaller创建一个exe文件。它与基本文件一起工作。然后,我使用pygame尝试了一个基本文件(它只创建了一个窗口):

import pygame
pygame.init()
fenetre = pygame.display.set_mode((640, 480))
pygame.key.set_repeat(50, 5)

    cont = 1
    while cont == 1:
    for event in pygame.event.get():
        if event.type == QUIT:
            cont = 0

pygame.quit()

我可以创建一个exe文件,使用pyinstaller--onefile。 但是当我打开exe文件(在dist中)时,pygame窗口不会出现


Tags: 文件keyimporteventinitmodewindowsdisplay