python 3.9.1中的pygame

2024-04-24 20:06:44 发布

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

昨天我用pygame和我的Python3.9版本一起使用,一切正常。 今天我决定升级到Python3.9.1,但它并没有打开pygame窗口。 它不会向我显示错误,或者什么都不会出现。 如果我使用另一个版本的python 3.6、3.7和3.8,如果它适合我的话。是版本有问题还是我做错了什么? 附言:我是编程新手

import pygame
 
pygame.init()
 
size = [400, 500]
display = pygame.display.set_mode(size)
 
pygame.display.set_caption("test")
 
done = False
clock = pygame.time.Clock()
 
while not done:
 
    for evento in pygame.event.get(): 
        if evento.type == pygame.QUIT:
            done = True

    clock.tick(60)
 
pygame.quit()

我正在使用Supreme text3: enter image description here


Tags: import版本sizeinitmode编程错误display
2条回答

您需要提供有关操作系统以及PyGame要使用的版本的更多信息

请参阅this issue about Python 3.9 support,您可以从社区中找到更多信息和答案,我认为您会找到这个问题的解决方案:

我能够从Python 3.9.1的源代码安装PyGame 2.0。在FedoraLinux发行版上

。。。根据作者对这个问题的评论和随后的补充:

最新的功能版本是Python 3.9.0和PyGame 2.0

你为什么写pygame.evento.get 您应该键入pygame.event.get

相关问题 更多 >