Search code examples
cairogtk3pygobjectpycairo

How to overlay transparent buttons on top of Gtk.drawingarea


I have created a Gtk.grid which contains a bunch of buttons that are resizable and draggable around the grid.

I have also created a Gtk.drawingarea which draws grid lines. I wish to make my buttons transparent like so:

Gtk.Button.set_property("opacity", 0.3)

This successfully makes the buttons transparent; however, it does not allow me to see the grid of lines behind the buttons.

I know that I am overlaying them correctly with a Gtk.Overlay widget, because a portion of the lines that are not directly behind the buttons are displayed properly.

My question is, how can I see the rest of the drawing area which is BEHIND the transparent buttons? I have tried setting the containers to be transparent, setting the Gdk.Window transparency, nothing is working. Is this just something that is not possible with Gtk3?


Solution

  • Well, I don't know why I never tried this before. The answer is to set the opacity property on the Gtk.Overlay widget itself.

    Gtk.Overlay.set_property("opacity", 0.5)