loading...

Pygame is not working In linux

gogamic profile image Raghav Mrituanjaya Updated on ・1 min read

Hello guys I am trying to make a gmae in pygame I have python 3.6 installed and this is how my code looks

import pygame
pygame.init()



screen = pygame.display.set_mode([800, 600])

pygame.display.set_caption('Little UFO')



# actors

ufo = pygame.image.load('ufo.png')


def player(): 
    screen.blit(ufo, (375, 591))




run = True


while run:

    screen.fill([255,255,255])

    for event in pygame.event.get():

       if event.type == pygame.QUIT:
                   run = False

    player()

When I open I see black background even though I have selected white and I can't see the ufo

Discussion

markdown guide
 

It would helpful if you could format the code, since in Python indentation matters, the code you posted is a ambiguous and we don't know what it is supposed to do.

 

Hi There man well on my code on my pc I have intended it correctly

 

Yeah but in order for us to be able to read it correctly it needs to be indented here as well.

I am so sorry I will edit it

 

I have never used Pygame before, but could you please try passing a touple instead of a list?

screen.fill([255,255,255]) ->     screen.fill((255,255,255))
 

Tried it but thanks for the reply