3
votes
from tkinter import *

master = Tk()
master.resizable(False, False)
master.geometry('430x480+50+50')
master.title("Ping Check")
master.config(bg="#222")

layer = PhotoImage(file ="logo.gif")
topFrame = Label(text="Ping Checker", image=layer, fg="#fff", font="Bahnschrift 14")
topFrame.place(x=11,y=10)

I'm using the following code, which displays the image, however, the label seems to have a background, which I do not want.

Click for reference and the file https://imgur.com/a/JR4Hc

1
Huh? Don't understand what you're asking. The image I put below is how it looks, the white box shouldnt be there. - Chris
Please provide a minimal reproducible example to reproduce the issue, and optionally update the image with that code's entire GUI. - Nae
There we go. Updated. - Chris
Thanks a lot. I think this is a much better question now. I edited your earlier one to show image embedded, you can do this by adding the image link as an image instead of a regular link. Note that if it lacks mainloop then the code above depends on something else to produce the GUI. - Nae
As in, the actual file? - Chris

1 Answers

6
votes

It's not that the Label can't show a transparent image, it's rather label has its own background color which is not transparent or the same as its parent. One workaround would simply be using its parent's bg as its own bg:

topFrame['bg'] = topFrame.master['bg']