I am running the following code:
import pygame
pygame.init()
img = pygame.image.load("Picture.jpg")
white = (255, 255, 255)
w = 900
h = 450
screen = pygame.display.set_mode((w, h))
screen.fill((white))
screen.fill((white))
screen.blit(img(0,0))
pygame.display.flip()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
When I run the code the pygame window opens, but it is blank(black) screen. I also get the following error message: Traceback (most recent call last):
File "C:/Users/Draco/OneDrive/Documents/Programming/graphics.py", line 13, in screen.blit(img(0,0)) TypeError: 'pygame.Surface' object is not callable
The image I am trying to open is saved as a JPG file. The image is saved under the name Picture. Many thanks in advance for any help.
screen.blit(img, (0,0))instead ofscreen.blit(img(0,0)). - Christian Dean