Ask coding questions

← Back to all posts
hello friends. How can I create game window for any game with pygame?
SheikhIstiak (2)

HELLO everyone . i need help.


if you have set the game properly, the window will popup.

DrHalloween (14)

As far as I know, you have a game window? When the code is ran, a window labelled "space fighters" appears on the left.

TurtleAndrew (201)

Here's the code to have the screen render a solid color and update. If you need anymore help than tell me and i can help you. I have spent a long time using pygame and know it pretty well.

import pygame

screen = pygame.display.set_mode((800, 600))
pygame.display.set_caption("space fighters")
running = True

while running:
for event in pygame.event.get():
if event.type ==pygame.quit:
running= False

if not running:

screen.fill((225, 225, 225)) # replace the tupple with your desiered color