python能够设置标签背景色的属性是_python-Tkinter标签背景?

我再次对Tkinter有问题.

您可以在图像中看到,默认情况下,标签的背景为灰色.现在,我已经设置了一个标签作为背景,由于明显的原因,我想使文本标签中的灰色消失.我如何设法使标签的背景透明?

from Tkinter import *

# ***** Start of Gui *****

root = Tk()

root.title("Here could be your ad")

root.geometry("350x150")

root.minsize(350,150)

root.resizable(False, False)

# ***** Background *****

photo = PhotoImage(file="recycled.gif")

background_label = Label(root, image=photo)

background_label.place(x=0, y=0, relwidth=1, relheight=1)

background_label.image = photo

# ***** Text *****

l1 = Label(root, text="Here could be your ad")

l2 = Label(root, text="Here could be your ad")

l3 = Label(root, text="Here could be your ad")

l4 = Label(root, text="Here could be your ad")

l1.grid(row=0, sticky=W)

l2.grid(row=1, sticky=W)

l3.grid(row=2, sticky=W)

l4.grid(row=3, sticky=W)

# ***** Variables for Input *****

var0 = StringVar()

var1 = StringVar()

var2 = StringVar()

var3 = StringVar()

# ***** Input Boxes *****

e1 = Entry(root, textvariable=var0)

e2 = Entry(root, textvariable=var1)

e3 = Entry(root, textvariable=var2)

e4 = Entry(root, textvariable=var3)

e1.grid(row=0, column=1)

e2.grid(row=1, column=1)

e3.grid(row=2, column=1)

e4.grid(row=3, column=1)

#Button

b = Button(root, text="Here could be your ad", bg='blue')

b.grid(row=4, column=1)

root.mainloop()

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值