gtk.StatusIcondisplay an icon in the system tray (new in PyGTK
2.10)Synopsisgtk.StatusIcongobject.GObjectgtk.StatusIconget_storage_typeget_giconget_pixbufget_stockget_icon_nameget_sizeget_x11_window_idset_tooltiptooltip_textset_visiblevisibleget_visibleset_blinkingblinkingget_blinkingis_embeddedget_geometryscreenareaorientationget_screenset_screenscreenset_from_pixbufpixbufset_from_filefilenameset_from_stockstock_idset_from_icon_nameicon_nameset_from_gicongiconset_namenameset_titletitleget_titleset_has_tooltiphas_tooltipget_has_tooltipset_tooltip_texttextget_tooltip_textset_tooltip_markupmarkupget_tooltip_markupFunctionsgtk.status_icon_new_from_pixbufpixbufgtk.status_icon_new_from_filefilenamegtk.status_icon_new_from_giconfilenamegtk.status_icon_new_from_stockstock_idgtk.status_icon_new_from_icon_nameicon_namegtk.status_icon_position_menumenustatusiconAncestry+-- gobject.GObject
+-- gtk.StatusIcon
gtk.StatusIcon Properties
"blinking"Read-Writeif True the status icon is
blinking. Default value: False."embedded"Read-WriteTrue if the status icon is
embedded in a notification area.
Default value: False.
This property is available in GTK+ 2.12 and above."file"WriteFilename to load and display. Default value:
None."gicon"Read-WriteThe GIcon displayed in the GtkStatusIcon. For themed icons,
the image will be updated automatically if the theme changes.
Available from GTK+ 2.14.
"icon-name"Read-WriteThe name of the icon from the icon theme. Default value:
None."orientation"Read-WriteThe orientation of the tray in which the statusicon is embedded.
Default value: gtk.ORIENTATION_HORIZONTAL.
This property is available in GTK+ 2.12 and above."pixbuf"Read-WriteA gtk.gdk.Pixbuf
to display."size"ReadThe size of the icon. Default value: 0."stock"Read-WriteStock ID for a stock image to display. Default value:
None."storage-type"ReadThe representation being used for image data. Default
value: gtk.IMAGE_EMPTY."title"Read-WriteThe title of this tray icon. This should be a short, human-readable,
localized string describing the tray icon. It may be used by tools like
screen readers to render the tray icon.
Default value: None.
This property is available in GTK+ 2.18 and above."tooltip-markup"Read-WriteSets the text of the tooltip to be the given string, which is marked up
with the Pango text markup language.
Default value: None.
This property is available in GTK+ 2.16 and above."tooltip-text"Read-WriteSets the text of tooltip to be the given string.
Default value: None.
This property is available in GTK+ 2.16 and above."visible"Read-WriteIf True the status icon is
visible. Default value: True.
gtk.StatusIcon Signal Prototypesgobject.GObject Signal Prototypes"activate"callbackstatus_iconuser_param1..."popup-menu"callbackstatus_iconbuttonactivate_timeuser_param1..."size-changed"callbackstatus_iconsizeuser_param1...DescriptionThe "system tray" or notification area is normally used for
transient icons that indicate some special state. For example, a system
tray icon might appear to tell the user that they have new mail, or have
an incoming instant message, or something along those lines. The basic
idea is that creating an icon in the notification area is less annoying
than popping up a dialog.A gtk.StatusIcon
object can be used to display an icon in a "system tray". The icon can
have a tooltip, and the user can interact with it by activating it or
popping up a context menu. Critical information should not solely be
displayed in a gtk.StatusIcon,
since it may not be visible (e.g. when the user doesn't have a
notification area on his panel). This can be checked with the gtk.StatusIcon.is_embedded()
method.On X11, the implementation follows the freedesktop.org "System
Tray" specification.
Implementations of the "tray" side of this specification can be found
e.g. in the GNOME and KDE panel applications.Note that a gtk.StatusIcon
is not a widget, but just a gobject.GObject.
Making it a widget would be impractical, since the system tray on Win32
doesn't allow to embed arbitrary widgets.Constructorgtk.StatusIcongtk.StatusIconReturns :a new gtk.StatusIconThis constructor is available in PyGTK 2.10 and above.Creates an empty status icon object.Methodsgtk.StatusIcon.set_from_pixbufset_from_pixbufpixbufpixbuf :a gtk.gdk.Pixbuf
or NoneThis method is available in PyGTK 2.10 and above.Makes status_icon display
pixbuf. See the gtk.status_icon_new_from_pixbuf()
function for details.gtk.StatusIcon.set_from_fileset_from_filefilenamefilename :a filenameThis method is available in PyGTK 2.10 and above.Makes status_icon display the file
filename. See the gtk.status_icon_new_from_file()
function for details.gtk.StatusIcon.set_from_stockset_from_stockstock_idstock_id :a stock icon idThis method is available in PyGTK 2.10 and above.Makes status_icon display the stock icon
with the id stock_id. See the gtk.status_icon_new_from_stock()
function for details.gtk.StatusIcon.set_from_icon_nameset_from_icon_nameicon_nameicon_name :an icon nameThis method is available in PyGTK 2.10 and above.Makes status_icon display the icon named
icon_name from the current icon theme. See the
gtk.status_icon_new_from_icon_name()
function for details.gtk.StatusIcon.set_from_giconset_from_gicongicongicon :a gio.Icon()This method is available in PyGTK 2.14 and above.Makes status_icon display the gio.Icon()
See gtk.status_icon_new_from_gicon()
for detailsgtk.StatusIcon.get_storage_typeget_storage_typeReturns :the image representation being used - one of
the .This method is available in PyGTK 2.10 and above.Gets the type of representation being used by the gtk.StatusIcon
to store image data. If the gtk.StatusIcon
has no image data, the return value will be
gtk.IMAGE_EMPTY.gtk.StatusIcon.get_giconget_giconReturns :the displayed icon, or None
if the image is empty.This method is available in PyGTK 2.14 and above.
Retrieves the gio.Icon() being displayed by the
gtk.StatusIcon.
The storage type of the status icon must be gtk.IMAGE_EMPTY or gtk.IMAGE_GICON.
If this method fails, icon is left unchanged;
gtk.StatusIcon.get_x11_window_idget_x11_window_idReturns :An 32 bit unsigned integer identifier for the
underlying X11 Window.This method is available in PyGTK 2.14 and above.
This function is only useful on the X11/freedesktop.org platform. It
returns a window ID for the widget in the underlying status icon
implementation. This is useful for the Galago notification service,
which can send a window ID in the protocol in order for the server
to position notification windows pointing to a status icon reliably.
This function is not intended for other use cases which are more likely
to be met by one of the non-X11 specific methods,
such as
gtk.status_icon_position_menu().
gtk.StatusIcon.get_pixbufget_pixbufReturns :the displayed pixbuf, or
None if the image is
empty.This method is available in PyGTK 2.10 and above.Gets the gtk.gdk.Pixbuf
being displayed by the gtk.StatusIcon.
The storage type of the status icon must be
gtk.IMAGE_EMPTY or
gtk.IMAGE_PIXBUF (see the gtk.StatusIcon.get_storage_type()
method).gtk.StatusIcon.get_stockget_stockReturns :stock id of the displayed stock icon, or
None if the image is
empty.This method is available in PyGTK 2.10 and above.Gets the id of the stock icon being displayed by the gtk.StatusIcon.
The storage type of the status icon must be
gtk.IMAGE_EMPTY or
gtk.IMAGE_STOCK (see the gtk.StatusIcon.get_storage_type()
method).gtk.StatusIcon.get_icon_nameget_icon_nameReturns :name of the displayed icon, or
None if the image is
empty.This method is available in PyGTK 2.10 and above.Gets the name of the icon being displayed by the gtk.StatusIcon.
The storage type of the status icon must be
gtk.IMAGE_EMPTY or
gtk.IMAGE_ICON_NAME (see the gtk.StatusIcon.get_storage_type()
method).gtk.StatusIcon.get_sizeget_sizeReturns :the size that is available for the
imageThis method is available in PyGTK 2.10 and above.Gets the size in pixels that is available for the image. Stock
icons and named icons adapt their size automatically if the size of
the notification area changes. For other storage types, the
"size-changed" signal can be used to react to size changes.gtk.StatusIcon.set_tooltipset_tooltiptooltip_texttooltip_text :the tooltip text, or
NoneThis method is available in PyGTK 2.10 and above.Sets the tooltip of the status icon.gtk.StatusIcon.set_visibleset_visiblevisiblevisible :if True show the status
icon, if False hide itThis method is available in PyGTK 2.10 and above.Shows or hides a status icon.gtk.StatusIcon.get_visibleget_visibleReturns :True if the status icon is
visibleThis method is available in PyGTK 2.10 and above.Returns True if the status icon is visible.
Note that being visible does not guarantee that the user can actually
see the icon, see also the gtk.StatusIcon.is_embedded()
method.gtk.StatusIcon.set_blinkingset_blinkingblinkingblinking :if True turn blinking on, if
False turn it offThis method is available in PyGTK 2.10 and above.Makes the status icon start or stop blinking. Note that
blinking user interface elements may be problematic for some users,
and thus may be turned off, in which case this setting has no
effect.gtk.StatusIcon.get_blinkingget_blinkingReturns :True if the icon is
blinkingThis method is available in PyGTK 2.10 and above.Returns True if the icon is blinking, see the
gtk.StatusIcon.set_blinking()
method.gtk.StatusIcon.is_embeddedis_embeddedReturns :True if the status icon is
embedded in a notification area.This method is available in PyGTK 2.10 and above.Returns True if the status icon is embedded
in a notification area.gtk.StatusIcon.get_geometryget_geometryReturns :a 3-tuple (containing the screen, area occupied
by the status icon and the panel orientation) or
None.This method is available in PyGTK 2.10 and above.Returns information in a 3-tuple about the location of the
status icon on screen. The 3-tuple contains the gtk.gdk.Screen,
the area occupied by the status icon as a gtk.gdk.Rectangle
and the orientation of the panel containing the statis icon - one of
the . This information
can be used to e.g. position popups like notification bubbles. See
the gtk.status_icon_position_menu()
function for a more convenient alternative for positioning
menus.Note that some platforms do not provide this information.gtk.StatusIcon.get_screenget_screenReturns :a
gtk.gdk.Screen.This method is available in PyGTK 2.12 and above.Returns the gtk.gdk.Screen
associated with status_icon.gtk.StatusIcon.set_screenset_screenscreenscreen :a
gtk.gdk.Screen.This method is available in PyGTK 2.12 and above.Sets the gtk.gdk.Screen
where status_icon is displayed; if the icon is already mapped, it will be unmapped,
and then remapped on the new screen.Functionsgtk.status_icon_new_from_pixbufgtk.status_icon_new_from_pixbufpixbufpixbuf :Returns :a new gtk.StatusIconCreates a status icon displaying pixbuf.
The image will be scaled down to fit in the available space in the
notification area, if necessary.gtk.status_icon_new_from_filegtk.status_icon_new_from_filefilenamefilename :Returns :a new gtk.StatusIconCreates a status icon displaying the image in the file specified
by filename. The image will be scaled down to
fit in the available space in the notification area, if
necessary.gtk.status_icon_new_from_gicongtk.status_icon_new_from_gicongicongicon :Returns :a new gtk.StatusIcon
Creates a status icon displaying a gio.Icon(). If the icon is a
themed icon, it will be updated when the theme changes.
gtk.status_icon_new_from_stockgtk.status_icon_new_from_stockstock_idstock_id :a stock icon idReturns :a new gtk.StatusIconCreates a status icon displaying a stock icon. Sample stock icon
names are gtk.STOCK_OPEN,
gtk.STOCK_QUIT. You can register your own stock
icon names, see the gtk.IconFactory.add_default()
and gtk.IconFactory.add()
methods.gtk.status_icon_new_from_icon_namegtk.status_icon_new_from_icon_nameicon_nameicon_name :an icon nameReturns :a new gtk.StatusIconCreates a status icon displaying an icon from the current icon
theme. If the current icon theme is changed, the icon will be updated
appropriately.gtk.status_icon_position_menugtk.status_icon_position_menumenustatusiconmenu :the gtk.Menustatusicon :the gtk.StatusIconReturns :a 3-tuple containing the x and y coordinates
for the menu and a boolean indicating whether the menu should be
pushed in to be completely inside the screen instead of just
clamped to the size to the screen.Menu positioning function to use with the popup()
method to position menu aligned to
statusicon .Eample use of this function is:
menu.popup(None, None, gtk.status_icon_position_menu,
event.button, event.time, statusicon)
gtk.StatusIcon.set_nameset_namenamename :the name.This method is available in PyGTK 2.22 and above.The set_name() method sets the name of this tray icon.
This should be a string identifying this icon. It is may be used for sorting the icons
in the tray and will not be shown to the user.gtk.StatusIcon.set_titleset_titletitletitle :the title.This method is available in PyGTK 2.22 and above.The set_title() method sets the title of this tray icon.
This should be a short, human-readable, localized string describing the tray icon. It
may be used by tools like screen readers to render the tray icon.gtk.StatusIcon.get_titleget_titleReturns :the title of the status icon.This method is available in PyGTK 2.22 and above.The get_title() method gets the title of this tray icon.gtk.StatusIcon.set_has_tooltipset_has_tooltiphas_tooltiphas_tooltip :True if the status icon has a tooltip, False otherwise.This method is available in PyGTK 2.16 and above.The set_has_tooltip() method sets the "has-tooltip" property.gtk.StatusIcon.get_has_tooltipget_has_tooltipReturns :True if the status icon has a tooltip, False otherwise..This method is available in PyGTK 2.16 and above.The get_has_tooltip() method returns the current value of the "has-tooltip" property.gtk.StatusIcon.set_tooltip_textset_tooltip_texttexttext :the contents of the tooltip for the status icon, or None.This method is available in PyGTK 2.16 and above.The set_tooltip_text() method sets text
as the contents of the tooltip. This function will take care of setting
the "has-tooltip" property to True and of the default handler
for the "query-tooltip" signal.gtk.StatusIcon.get_tooltip_textget_tooltip_textReturns :the tooltip text, or None.This method is available in PyGTK 2.16 and above.The get_tooltip_text() method gets the
contents of the tooltip for the status icon.gtk.StatusIcon.set_tooltip_markupset_tooltip_markupmarkupmarkup :the contents of the tooltip for widget, or None.This method is available in PyGTK 2.16 and above.The set_tooltip_markup() method sets markup as the
contents of the tooltip, which is marked up with the Pango text markup language.
This function will take care of setting the "has-tooltip" property to
True and of the default handler for the "query-tooltip" signal.gtk.StatusIcon.get_tooltip_markupget_tooltip_markupReturns :the tooltip text, or None.This method is available in PyGTK 2.16 and above.The get_tooltip_markup() method gets the
contents of the tooltip for the status icon.SignalsThe "activate" gtk.StatusIcon Signalcallbackstatus_iconuser_param1...status_icon :the object which received the signaluser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if any)This signal is available in GTK+ 2.10 and above.Gets emitted when the user activates the status icon. If and
how status icons can be activated is platform-dependent.The "popup-menu" gtk.StatusIcon Signalcallbackstatus_iconbuttonactivate_timeuser_param1...status_icon :the object which received the signalbutton :the button that was pressed, or 0 if the
signal is not emitted in response to a button press eventactivate_time :the timestamp of the event that
triggered the signal emissionuser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if any)This signal is available in GTK+ 2.10 and above.Gets emitted when the user brings up the context menu of the
status icon. Whether status icons can have context menus and how these
are activated is platform-dependent.The button and
activate_time parameters should be passed as
the last two arguments to the gtk.Menu.popup()
method.The "size-changed" gtk.StatusIcon Signalcallbackstatus_iconsizestatusiconarg1user_param1...status_icon :the object which received the signalsize :the new sizeuser_param1 :the first user parameter (if any) specified
with the connect()
method... :additional user parameters (if any)Returns :True if the icon was updated
for the new size. Otherwise, GTK+ will scale the icon as
necessary.This signal is available in GTK+ 2.10 and above.Gets emitted when the size available for the image changes,
e.g. because the notification area got resized.