:right-sidebar: True IconPaintable =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: IconPaintable(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gdk.Paintable`, :class:`~gi.repository.Gtk.SymbolicPaintable` Contains information found when looking up an icon in ``GtkIconTheme``. ``GtkIconPaintable`` implements ``GdkPaintable``. Constructors ------------ .. rst-class:: interim-class .. class:: IconPaintable :no-index: .. classmethod:: new_for_file(file: ~gi.repository.Gio.File, size: int, scale: int) -> ~gi.repository.Gtk.IconPaintable Creates a ``GtkIconPaintable`` for a file with a given size and scale. The icon can then be rendered by using it as a ``GdkPaintable``. :param file: a ``GFile`` :param size: desired icon size :param scale: the desired scale Methods ------- .. rst-class:: interim-class .. class:: IconPaintable :no-index: .. method:: get_file() -> ~gi.repository.Gio.File | None Gets the ``GFile`` that was used to load the icon. Returns :const:`None` if the icon was not loaded from a file. .. method:: get_icon_name() -> str | None Get the icon name being used for this icon. When an icon looked up in the icon theme was not available, the icon theme may use fallback icons - either those specified to :func:`~gi.repository.Gtk.IconTheme.lookup_icon` or the always-available "image-missing". The icon chosen is returned by this function. If the icon was created without an icon theme, this function returns :const:`None`. .. method:: is_symbolic() -> bool Checks if the icon is symbolic or not. This currently uses only the file name and not the file contents for determining this. This behaviour may change in the future. Note that to render a symbolic ``GtkIconPaintable`` properly (with recoloring), you have to set its icon name on a ``GtkImage``. Properties ---------- .. rst-class:: interim-class .. class:: IconPaintable :no-index: .. attribute:: props.file :type: ~gi.repository.Gio.File The file representing the icon, if any. .. attribute:: props.icon_name :type: str The icon name that was chosen during lookup. .. attribute:: props.is_symbolic :type: bool Whether the icon is symbolic or not.