PYTHON NEWBIE .. piecing together zombie code.. Need the black part of an image.png displayed using PYGAME to be transparent and be able to click what ever is under it :) TIA
Any help appreciated :D
import pygame
Initialize pygame and set the screen resolution
pygame.init()
screen = pygame.display.set_mode((1920, 1080),pygame.HWSURFACE|pygame.DOUBLEBUF|pygame.NOFRAME)
Load the image
image = pygame.image.load("image1.png").convert_alpha()
Scale the image to fit the screen resolution
image = pygame.transform.scale(image, (screen.get_width(), screen.get_height()))
Set the transparency level of the image
image.set_alpha(255)
Set the transparent color of the image
image.set_colorkey((0,0,255))
Blit the image to the screen
screen.blit(image, (0, 0))
Update the screen
pygame.display.flip()
Main loop
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
Quit pygame
pygame.quit()
This code loads the image correctly however the black part of the image remains black. Or maybe it goes transparent and the back of the program panel is black and opaque so and i just never notice lolyour text