gtk.IconSetcontains a set of variants for an iconSynopsisgtk.IconSetgobject.GBoxedgtk.IconSetpixbufNonecopyrender_iconstyledirectionstatesizewidgetdetailadd_sourcesourceget_sizesDescriptionA gtk.IconSet
contains a set of variants for a single icon. The variants provide icons of
different sizes and for different widget states. The variants can be added
with the add_source()
method.Constructorgtk.IconSetpixbufNonepixbuf :a gtk.gdk.PixbufReturns :a new gtk.IconSetCreates a new gtk.IconSet with
pixbuf as the default fallback source image. If
pixbuf is None there is no default
fallback source image. If you don't add any additional gtk.IconSources
to the icon set, all variants of the icon will be created from
pixbuf, using scaling, pixelation, etc. as required
to adjust the icon size or make the icon look insensitive/prelighted.Methodsgtk.IconSet.copycopyReturns :a new gtk.IconSet
identical to the first.The copy() method returns a copy of the
icon set.gtk.IconSet.render_iconrender_iconstyledirectionstatesizewidgetdetailstyle :a gtk.Style associated
with widget, or
Nonedirection :the text direction; one of:
gtk.TEXT_DIR_NONE, gtk.TEXT_DIR_LTR,
gtk.TEXT_DIR_RTLstate :the widget state; one of:
gtk.STATE_NORMAL, gtk.STATE_ACTIVE,
gtk.STATE_PRELIGHT,
gtk.STATE_SELECTED,
gtk.STATE_INSENSITIVEsize :the icon size; one of:
gtk.ICON_SIZE_INVALID,
gtk.ICON_SIZE_MENU,
gtk.ICON_SIZE_SMALL_TOOLBAR,
gtk.ICON_SIZE_LARGE_TOOLBAR,
gtk.ICON_SIZE_BUTTON,
gtk.ICON_SIZE_DND,
gtk.ICON_SIZE_DIALOGwidget :the widget that will display the icon, or
Nonedetail :the detail to pass to the theme engine, or
NoneReturns :a gtk.gdk.Pixbuf to be
displayedThe render_icon() method renders an
icon using gtk.Style.render_icon().
In most cases, gtk.Widget.render_icon()
is better, since it automatically provides most of the arguments from the
current widget settings. This method never returns None;
if the icon can't be rendered (perhaps because an image file fails to load),
a default "missing image" icon will be returned instead.gtk.IconSet.add_sourceadd_sourcesourcesource :a gtk.IconSourceThe add_source() method adds the gtk.IconSource
specified by source to the icon set. Icon sets have
a list of gtk.IconSource,
which they use as base icons for rendering icons in different states and
sizes. Icons are scaled, made to look insensitive, etc. in the render_icon()
method, but gtk.IconSet needs
base images to work with. The base images and when to use them are described
by a gtk.IconSource.An example of when you'd use this method: a web browser's
"Back to Previous Page" icon might point in a
different direction in Hebrew and in English; it might look different when
insensitive; and it might change size depending on toolbar mode (small
or large icons). So a single icon set would contain all those variants of the
icon, and you might add a separate source for each one.You should nearly always add a "default" icon source with all
fields wildcarded, which will be used as a fallback if no more specific
source matches. gtk.IconSet always
prefers more specific icon sources to more generic icon sources. The order
in which you add the sources to the icon set does not matter.The gtk.IconSet()
constructor creates a new icon set with a default icon source based on the
given pixbuf.gtk.IconSet.get_sizesget_sizesReturns :a tuple containing all the icon sizes supported
by the icon setThe get_sizes() method returns a tuple
containing all the icon sizes this icon set can render.