Im trying to create a simple window that will record a mouse's position on click, but I need to set the background display to an image.
So far I have this:
import pygame
LEFT = 1
pygame.display.init()
screen = pygame.display.set_mode((320,200))
pygame.mouse.set_visible(False)
image = pygame.image.load("picture.png")
screen.blit(image, (100,100))
running = 1
while running:
event = pygame.event.poll()
if event.type == pygame.QUIT:
running = 0
elif event.type == pygame.MOUSEBUTTONDOWN and event.button == LEFT:
print("Left mouse was pressed at: %d, %d" %event.pos)
pygame.display.flip()
The mouse clicks are working correctly, even when trying to load the image, just the window is remaining black.