我目前正在关注Eric Matthes的Python速成课程(第一版),并且正在尝试制作pygame程序。但是,我一直无法关闭pygame窗口,不幸的是,尝试this other post中提到的所有解决方案对我来说都没有用。 (我正在使用Python 3.7.6,Spider 4.1.4和pygame 1.9.6。)
我当前的代码如下: (我一开始关注这本书,但后来又对其进行了多次修改)
import sys
import pygame
def run_game():
pygame.init()
screen = pygame.display.set_mode((1200,800))
pygame.display.set_caption("Alien Invasion")
bg_color = (230, 230, 230)
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
pygame.quit()
sys.exit()
screen.fill(bg_color)
pygame.display.flip()
run_game()
可能我有什么想念的地方吗?
任何帮助将不胜感激!
更新:
答案 0 :(得分:0)
这可能会帮助您:
steps:
- task: IISWebAppDeploymentOnMachineGroup@0
displayName: 'IIS Web App Deploy'
inputs:
WebSiteName: '$(Parameters.WebsiteName)'
TakeAppOfflineFlag: True
XmlVariableSubstitution: True
我从这里获得了此解决方案:Closing Pygame Window