小白请教一下各位,为什么我ubuntu18.04下运行pygame会很卡,但是在CentOS7下运行又不卡。
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)
#开始游戏的主循环
while True:
#监视键盘和鼠标事件
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
#每次循环时都重绘屏幕
screen.fill(bg_color)
#让最近绘制的屏幕可见
pygame.display.flip()
run_game()