DEV Community

Raghav Mrituanjaya
Raghav Mrituanjaya

Posted on • Updated on

Pygame is not working In linux

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()
Enter fullscreen mode Exit fullscreen mode

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

Top comments (6)

Collapse
 
nuculabs_dev profile image
Nucu Labs

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))
Collapse
 
raghavmri profile image
Raghav Mrituanjaya

Tried it but thanks for the reply

Collapse
 
nuculabs_dev profile image
Nucu Labs

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.

Collapse
 
raghavmri profile image
Raghav Mrituanjaya

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

Collapse
 
thijs0x57 profile image
thijs0x57

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

Thread Thread
 
raghavmri profile image
Raghav Mrituanjaya

I am so sorry I will edit it