如何解决从 shell 获取输入时 Pygame 窗口崩溃
我正在尝试制作一个需要来自 shell 的输入的项目。但是,当使用输入命令时,pygame 窗口会冻结,修复它的唯一方法是关闭窗口并重新启动程序。
import pygame
pygame.init()
size = (700,500)
screen = pygame.display.set_mode(size)
clicked = False
done = False
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
clicked = True
pygame.event.pump()
if clicked:
test = input()
print(test)
screen.fill((255,255,255))
pygame.display.flip()
pygame.quit()
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。