问题
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.
and the file https://imgur.com/a/JR4Hc
回答1:
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']
来源:https://stackoverflow.com/questions/48814937/tkinter-transparency-on-label