0

I want to add a background image in Tkinter. I did that by using Label. But the problem is, I want the frames above the image to be transparent so that only the main content remains visible while I don't get the white background, I get the image. I tried using the

root.wm_attributes('-transparentcolor', "red")

Way, and then assigning red as bg to the frame, but it makes the frame completely transparent, I can see my background applications instead of the underlying image. Here is what I am getting: enter image description here But I want the below image to continue above. Here is my code for adding the label background

image = Image.open("grocery-cart-with-item-1005638.jpg")
photo = ImageTk.PhotoImage(image, master=root)
bg_label = Label(root, image=photo)
bg_label.image = photo
bg_label.place(x=0, y=0, relwidth=1, relheight=1)

And here is the code for the main Frame which contains the graph and the heading for the graph:

frame = Frame(root,name="mainframe",bg="red")
frame.pack(side=TOP,fill=X)

How do I get the frame to be transparent so that the Label which has the image is visible

Reblochon Masque
  • 35,405
  • 10
  • 55
  • 80
Shantanu Shinde
  • 932
  • 3
  • 23
  • 48

0 Answers0