Help to create the screen
Hi
I am a beginner to pygame and i am learning the basics. if someone can help me please.The screen keeps disappearing...
Thanks..
Bookie0
Here this is what I found on the internet,
import pygame background_colour = (255,255,255) (width, height) = (300, 200) screen = pygame.display.set_mode((width, height)) pygame.display.set_caption('Practice') screen.fill(background_colour) pygame.display.flip() running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False
First, you need to import a few more modules:
You should also change line 6 to:
The reason that your windows disappears is because the game exits immediately as you have no game loop.
You should add this:
Hope I helped! :)