Picture#

class ignis.widgets.Widget.Picture(*args: Any, **kwargs: Any)#

Bases: Gtk.Picture.

A widget that displays an image at its native aspect ratio.

Properties:
  • image (str | GdkPixbuf.Pixbuf | None, optional, read-write): Icon name, path to an image or GdkPixbuf.Pixbuf.

  • width (int, optional, read-write): Width of the image.

  • height (int, optional, read-write): Height of the image.

  • content_fit (str, optional, read-write): Controls how a content should be made to fit inside an allocation. Default: "contain".

Content fit:
  • "fill": Make the content fill the entire allocation, without taking its aspect ratio in consideration.

  • "contain": Scale the content to fit the allocation, while taking its aspect ratio in consideration..

  • "cover": Cover the entire allocation, while taking the content aspect ratio in consideration.

  • "scale_down": The content is scaled down to fit the allocation, if needed, otherwise its original size is used.

For more info, see Gtk.ContentFit

Widget.Picture(
    image='path/to/img',
    width=20,
    height=30
)