屏幕填充不工作

2024-05-03 23:00:11 发布

您现在位置:Python中文网/ 问答频道 /正文

所以我遇到了一个奇怪的问题,我不能填满屏幕。我的密码是

#Import all modules
import pygame
import random
import math
import time

#Colors
BLACK = ( 0, 0, 0)
WHITE = ( 255, 255, 255)
GREEN = ( 0, 255, 0)
RED = ( 255, 0, 0)
ORANGe = (255, 115, 0)
YELLOW = (242, 255, 0)
BROWN = (115, 87, 39)
PURPLE = ( 298, 0, 246)
GRAY = ( 168, 168, 168)
BLUE = ( 0, 0, 255)
pygame.init()
# Clock
clock = pygame.time.Clock()
#Screen
screenx = 1000
screeny = 700
screen = pygame.display.set_mode([screenx,screeny])

#Title
pygame.display.set_caption("OUCH Version 0.1")
#Classes (if any)

#Variables
sound = True
password = False
titlescreen = True

#Booleans




#Sounds



#The graphics


#Positions


#Time management
fps = 60

#Other Things


#Main Loop__________________________________________________
done = False

while not done:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            done = True

    if titlescreen:

        screen.fill(WHITE)





    #Flip the Display
    pygame.display.flip
    clock.tick(fps)

#If done

pygame.quit()

我刚刚更新到python3.4,这可能就是问题所在。或者我忽略了什么。我试着把屏幕填成白色,但每次我运行它,屏幕总是变成黑色。感谢您的帮助。:)

我试过的

我试着看他们的东西是否是白色的,但当我尝试其他颜色时,它就不起作用了。我还尝试了用布尔值填充屏幕,但也不起作用。我也试过不做if titlescreen:,但是如果titlescreen==True:then bla bla


Tags: importeventtrueif屏幕timedisplaypygame