微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

为什么我的 Pygame 需要永远加载窗口?

如何解决为什么我的 Pygame 需要永远加载窗口?

这是我从 https://realpython.com/pygame-a-primer/获取一个非常简单的代码。即使我只是加载一个没有绘图的空白窗口,显示也需要 1 到 3 分钟。它确实有效,但显示时间应该不会太长。

# Simple pygame program

# Import and initialize the pygame library
import pygame
pygame.init()

# Set up the drawing window
screen = pygame.display.set_mode([500,500])

# Run until the user asks to quit
running = True
while running:

    # Did the user click the window close button?
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

    # Fill the background with white
    screen.fill((255,255,255))

    # Draw a solid blue circle in the center
    pygame.draw.circle(screen,(0,255),(250,250),75)

    # Flip the display
    pygame.display.flip()

# Done! Time to quit.
pygame.quit()

Windows 10、Python 3.8、Pygame 2.0.1、Pycharm

编辑:如果我使用 Pygame 1.9.6,它似乎工作正常,所以我想这就是我现在的解决方案。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。