Converting the image first. Then set colorkey. You don't add colorkey to screen. Also you need to refresh screen.
It also better to use a path tool for joining paths. It makes it more portable.
It also better to use a path tool for joining paths. It makes it more portable.
from pathlib import Path from sprites import Sprite import pygame as py screen = py.display.set_mode((300, 300)) Sprite.load('button_icon', Path('Ressources', 'Sprites', 'button_icon.png')) sprt = Sprite.get('button_icon', (256, 64), (128, 0, 64, 64)) sprt.convert() sprt.set_colorkey((sprt.get_at(0, 0)) running = True while running: for event in py.event.get(): if event.type == py.QUIT: running = False # Refresh screen screen.fill('black') screen.blit(sprt, (0, 0)) py.display.flip()
99 percent of computer problems exists between chair and keyboard.