I was wondering if there is a way to make a transparent image for Tkinter. I was wanting to layer some images at random so I wouldn't know the background to use... at first I was using .GIF but I heard .PNG worked for transparency but I couldn't get .PNG into Tkinter any help?

almost two weeks and I still haven't gotten any replies... I need to layer images but the background( of white) always shows up is there anyway to fix that?

Here is a simple way to accomplish transparency using the Tkinter GUI toolkit ...

# explore Tkinter transparency (simplified)

try:
    # Python2
    import Tkinter as tk
except ImportError:
    # Python3
    import tkinter as tk

root = tk.Tk()

# use opacity alpha values from 0.0 to 1.0
# opacity/tranparency applies to image and frame
root.wm_attributes('-alpha', 0.7)  

# use a GIF image you have in the working directory
# or give full path
photo = tk.PhotoImage(file="LAKE.gif")

tk.Label(root, image=photo).pack()

root.mainloop()

thanks snippsat I'll look into that and vegaseat I was looking to get pictures to stack but making a transparent window could come in handy...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.