Waimate Wihongi
Waimate Wihongi

Reputation: 21

Pygame fill command not working?

Im quite new to python and im starting to get the hang of it and now im starting to use pygame and im trying to fill the screen with color but its not working for some reason heres my code

import pygame
pygame.init()

white = (255,255,255)
black = (0,0,0)
orange = (255,165,0)

display = pygame.display.set_mode((1280,1024))

pygame.display.set_caption('ReflectOS')

Exit = False

while not Exit:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            Exit = true

            display.fill(white)
            pygame.display.update()

        print(event)

pygame.quit()
quit()

Upvotes: 1

Views: 7311

Answers (1)

furas
furas

Reputation: 143110

You have wrong indentions - you fill screen only when you exit program

import pygame

white = (255,255,255)
black = (0,0,0)
orange = (255,165,0)


pygame.init()
display = pygame.display.set_mode((1280,1024))
pygame.display.set_caption('ReflectOS')

exit = False

while not exit:

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            exit = True
        print(event)

    display.fill(white)
    pygame.display.update()

pygame.quit()
quit()

Upvotes: 2

Related Questions