How to make the label background transparent ? python3 + Tkinter

Asked

Viewed 990 times

1

lbl2 = Label(jan, font=("Arial", 12, "bold"), text="Escolha apenas uma Categoria por vez")
lbl2.place(x=20, y=450)

I’m putting this label on top of a green image, but it ends up with her background gray, is there any way using Tkinter to leave only the text ? like a transparent background.

I’ve done some research here and can’t find anything that fits what I’m looking for.

1 answer

1

I would need more details about your code to help you with greater certainty of success, but you can do something similar to this.

Create a Canvas and apply the image inside it:

self.canvas = Canvas(root,width=810, height=500, bg="#000000",bd=0, highlightthickness=0, relief='ridge')
self.painel = self.canvas.create_image(403,350, image=self.image2)

Place Canvas as a Lower Layer

self.canvas.lower(self.painel)
self.canvas.pack(side=RIGHT, padx=0, ipady=20)

Overlay Canvas with your Label or other preferred object

retangule = self.canvas.create_rectangle(40,530,220,360,outline="")

Here is a support link: Tkinterbook

Browser other questions tagged

You are not signed in. Login or sign up in order to post.