0

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?

3
Contributors
4
Replies
11
Views
5 Years
Discussion Span
Last Post by Thropian
Featured Replies
  • [url]http://stackoverflow.com/questions/3270209/how-do-i-make-tkinter-support-png-transparency[/url] Wxpython has good support for transparent image,and may be a better choice. For me there has never been a choice i find wxpython much better than Tkinter. The ugly look of Tkinter in windows is not ok at all. PyQt and pyGTK shold also has support for this. Read More

  • 1

    Here is a simple way to accomplish transparency using the Tkinter GUI toolkit ... [code]# 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 … Read More

0

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?

1

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()
0

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...

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.