0

i try to load an image but when i run it the window won't stay open and shut down immediately can some one help me with this? when i delete the yellow space ship varible it run fine but when try to load it the window just stop working

import pygame
import os

width , height = 900 , 500

window = pygame.display.set_mode((width, height))

    pygame.display.set_caption("first game")

    teal = (153,255,255)

 fps = 60

yellow_spaceship = pygame.image.load(os.path.join('Assets','spaceship_yellow.png'))

def draw_window():
    window.fill(teal)
    window.blit((yellow_spaceship,(300, 100)))
    pygame.display.update()  

#keep window running
def main():
    clock = pygame.time.Clock()
    run = True
    draw_window()    
    while run:
        clock.tick(fps)
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
              run = False  
            draw_window()   
    pygame.quit()     
   



if __name__ == '__main__':
    main()
Rabbid76
  • 202,892
  • 27
  • 131
  • 174
potato-sam
  • 11
  • 2
  • Please correct the [Indentation](https://docs.python.org/3/reference/lexical_analysis.html) of your code. Do you get an error message? – Rabbid76 Sep 27 '21 at 12:45
  • It is a typo. `window.blit((yellow_spaceship,(300, 100)))` must be `window.blit(yellow_spaceship, (300, 100))`. (too many `()`) – Rabbid76 Sep 27 '21 at 12:50

0 Answers0