I am using python and I am trying to use the set_colorkey function from pygame. I drew a simple stick figure in Microsoft Paint and I tried to set the colorkey to (255, 255, 255), but that doesn’t work. I used a pixel array to try to find out the actual color of the background and it returned -1. I entered that as the colorkey, but it didn’t work. Can someone help me?
Share
I am unsure what you mean by “it didn’t work”, but from my own experience with color keys in pygame, setting the colorkey in the same line as loading the image will turn the image into a Nonetype object. This is because the set_colorkey method doesn’t return the image, but only sets the colorkey. Make sure that you didn’t write something like:
Additionally, writing set_colorkey(255,255,255) will cause an error, as the color parameter is one argument. That probably isn’t your problem, because I suspect that “it didn’t work” means that it blitted fine and without error, but did not get rid of the white that you want to make transparent.
Please provide more information, especially exactly what code you wrote to set the colorkey.
I hope I helped