注册 登录
编程论坛 Python论坛

求助 pygame 背景色怎么总是黑色

X月黑风高 发布于 2020-03-13 07:16, 2668 次点击
import pygame
import sys
from pygame.locals import *

def run_game():
    pygame.init()
    screen = pygame.display.set_mode((600, 400))
    pygame.display.set_caption("TEXTURE")
    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.update()

run_game()   
以上
求助各位大佬,为什么screen的背景色总是黑色
1 回复
#2
风卷浪起2021-11-22 21:25
因为你并没有设置背景色啊。
1