Gtk.IconPaintable

g GObject.GInterface GObject.GInterface Gdk.Paintable Gdk.Paintable GObject.GInterface->Gdk.Paintable Gtk.SymbolicPaintable Gtk.SymbolicPaintable GObject.GInterface->Gtk.SymbolicPaintable GObject.Object GObject.Object Gtk.IconPaintable Gtk.IconPaintable GObject.Object->Gtk.IconPaintable Gdk.Paintable->Gtk.IconPaintable Gtk.SymbolicPaintable->Gtk.IconPaintable

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gdk.Paintable (10), Gtk.SymbolicPaintable (1)

Structs:

GObject.ObjectClass (5)

class

new_for_file (file, size, scale)

get_file ()

get_icon_name ()

is_symbolic ()

Virtual Methods

Inherited:

GObject.Object (7), Gdk.Paintable (6), Gtk.SymbolicPaintable (1)

Properties

Name

Type

Flags

Short Description

file

Gio.File

r/w/co

icon-name

str

r/w/co

is-symbolic

bool

r/w/co

Signals

Inherited:

GObject.Object (1), Gdk.Paintable (2)

Fields

Inherited:

GObject.Object (1), Gdk.Paintable (2)

Class Details

class Gtk.IconPaintable(**kwargs)
Bases:

GObject.Object, Gdk.Paintable, Gtk.SymbolicPaintable

Abstract:

No

Contains information found when looking up an icon in GtkIconTheme.

GtkIconPaintable implements GdkPaintable.

classmethod new_for_file(file, size, scale)[source]
Parameters:
  • file (Gio.File) – a GFile

  • size (int) – desired icon size

  • scale (int) – the desired scale

Returns:

a GtkIconPaintable containing for the icon. Unref with GObject.Object.unref()

Return type:

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.

get_file()[source]
Returns:

the GFile for the icon

Return type:

Gio.File or None

Gets the GFile that was used to load the icon.

Returns None if the icon was not loaded from a file.

get_icon_name()[source]
Returns:

the themed icon-name for the icon, or None if its not a themed icon.

Return type:

str or 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 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 None.

is_symbolic()[source]
Returns:

True if the icon is symbolic, False otherwise

Return type:

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.

Property Details

Gtk.IconPaintable.props.file
Name:

file

Type:

Gio.File

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The file representing the icon, if any.

Gtk.IconPaintable.props.icon_name
Name:

icon-name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The icon name that was chosen during lookup.

Gtk.IconPaintable.props.is_symbolic
Name:

is-symbolic

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Whether the icon is symbolic or not.