原碼:如下
import sys
import pygame
def run_game():
pygame.init()
screen=pygame.display.set_mode((1200,800))
pygame.display.set_caption('Alien Invasion')
while True:
for event in pygame.event.get():
if event.type==pygame.QUIT:
sys.exit()
pygame.display.flip()
run_game()
uj5u.com熱心網友回復:
求解答,折磨一兩天了uj5u.com熱心網友回復:
報錯資訊顯示 模塊 pygame 沒有 QUIT 這個屬性QUIT 這個屬性是 pygame.locals 的
所以你要這樣匯入:
from pygame.locals import *
然后
while True:
for event in pygame.event.get():
if event.type == QUIT:
exit()
uj5u.com熱心網友回復:
樓主找到辦法解決沒,我也是遇到這個問題了....轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/55749.html
標籤:其他開發語言
上一篇:hadoop | 服務器分布式安裝hadoop,hbase,zookeeper,phoenix,spark | 集群啟動順序
