Declaration [src]

gtk_widget_set_opacity (
  GtkWidget* widget,
  double opacity

Description [src]

Request the widget to be rendered partially transparent.

An opacity of 0 is fully transparent and an opacity of 1 is fully opaque.

Opacity works on both toplevel widgets and child widgets, although there are some limitations: For toplevel widgets, applying opacity depends on the capabilities of the windowing system. On X11, this has any effect only on X displays with a compositing manager, see gdk_display_is_composited(). On Windows and Wayland it should always work, although setting a window’s opacity after the window has been shown may cause some flicker.

Note that the opacity is inherited through inclusion — if you set a toplevel to be partially translucent, all of its content will appear translucent, since it is ultimatively rendered on that toplevel. The opacity value itself is not inherited by child widgets (since that would make widgets deeper in the hierarchy progressively more translucent). As a consequence, GtkPopovers and other GtkNative widgets with their own surface will use their own opacity value, and thus by default appear non-translucent, even if they are attached to a toplevel that is translucent.

Sets propertyGtk.Widget:opacity



Type: double

Desired opacity, between 0 and 1.