I'm making something similar to the pygame
Python module.
I'm trying to make something simple and easy to use and making it as practical as possible. I use tkinter for basically everything except sound.
I'm having an issue where I'm loading an image on a tkinter label but it turns out with a black background.
Like this:
Here is my code for rendering images:
def draw_sprite(self, path: str, x: int, y: int, width: int, height: int):
"""
Draw an image at a the specified `x` and `y` cordinates with a `width` and `height`.
"""
try:
img = Image.open(path)
img = img.resize((width, height), Image.ANTIALIAS)
img = ImageTk.PhotoImage(img)
panel = Label(self.window, image = img)
panel.image = img
panel.place(x=x, y=y, width=width, height=height)
return panel
except TclError:
pass
Any help would be appreciated!
EDIT:
I eventually found a solution so this questionis closed now, thanks for anyoen who tried helping.
You can find the module at https://pypi.org/project/realityengine/