How can I add a transparent tkinter image in Python 3.3.2?

745 Views Asked by At

How can I add a transparent tkinter image in Python 3.3.2? I have tried using .gifs however the transparent parts become white.

Example:

from tkinter import *
Foo = PhotoImage(file=Bar)
image = Label(root, image=Foo)
image.pack()

It can find the image and everything however all transparent parts of the gif are white...

(They are transparent when opened in Photoshop or any other image viewing/editing program)

Thank you for any help! :D

(Psst. It doesn't have to be just gifs however if I try to use anything else; I get an error saying that it cannot read the data in my image.)

[Edit] Here is the traceback when I attempt to use the above code to open a .png with transparency.

  File "C:\Python33\lib\tkinter\__init__.py", line 3362, in __init__
    self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: couldn't recognize data in image file ".\Stuff\Foo.png"
0

There are 0 best solutions below