gtk.Tooltip Add tips to your widgets (new in PyGTK 2.12) Synopsis gtk.Tooltip gobject.GObject set_custom widget set_icon pixbuf set_icon_from_icon_name icon_name size set_icon_from_stock stock_id size set_markup markup set_text text Functions gtk.tooltip_trigger_tooltip_query display Ancestry +-- gobject.GObject +-- gtk.Tooltip Description gtk.Tooltip belongs to the new tooltips API that was introduced in GTK+ 2.12 and which deprecates the old gtk.Tooltips API. Basic tooltips can be realized simply by using gtk.Widget.set_tooltip_text() or gtk.Widget.set_tooltip_markup() without any explicit tooltip object. When you need a tooltip with a little more fancy contents, like adding an image, or you want the tooltip to have different contents per gtk.TreeView row or cell, you will have to do a little more work: Set the GtkWidget:has-tooltip property to True, this will make GTK+ monitor the widget for motion and related events which are needed to determine when and where to show a tooltip. Connect to the GtkWidget::query-tooltip signal. This signal will be emitted when a tooltip is supposed to be shown. One of the arguments passed to the signal handler is a gtk.Tooltip object. This is the object that we are about to display as a tooltip, and can be manipulated in your callback using functions like set_icon. There are functions for setting the tooltip's markup, setting an image from a stock icon, or even putting in a custom widget. Return True from your query-tooltip handler. This causes the tooltip to be show. If you return False, it will not be shown. In the probably rare case where you want to have even more control over the tooltip that is about to be shown, you can set your own gtk.Window which will be used as tooltip window. This works as follows: Set GtkWidget:has-tooltip and connect to GtkWidget::query-tooltip as before. Use gtk.Widget.set_tooltip_window() to set a gtk.Window created by you as tooltip window. In the ::query-tooltip callback you can access your window using gtk.Widget.get_tooltip_window() and manipulate as you wish. The semantics of the return value are exactly as before, return True to show the window, False to not show it. Methods gtk.Tooltip.set_custom set_custom widget widget : A gtk.Widget This method is available in PyGTK 2.12 and above. The set_custom() method replaces the widget packed into the tooltip with custom_widget. By default a box with a gtk.Image and gtk.Label is embedded in the tooltip, which can be configured using set_markup and set_icon. gtk.Tooltip.set_icon get_value pixbuf pixbuf : A gtk.gdk.Pixbuf or None. This method is available in PyGTK 2.12 and above. The set_icon() method sets the icon of the tooltip (which is in front of the text) to be pixbuf. If pixbuf is None, the image will be hidden. gtk.Tooltip.set_icon_from_icon_name set_icon_from_icon_name icon_name size icon_name : an icon name, or None. size : A stock icon size. This method is available in PyGTK 2.14 and above. The set_icon_from_icon_name() method sets the icon of the tooltip (which is in front of the text) to be the icon indicated by icon_name with the size indicated by size. If icon_name is None, the image will be hidden. gtk.Tooltip.set_icon_from_stock set_icon_from_stock stock_id size stock_id : A stock icon name, or None. size : A stock icon size. This method is available in PyGTK 2.12 and above. The set_icon_from_stock() method sets the icon of the tooltip (which is in front of the text) to be the stock item indicated by stock_id with the size indicated by size. If stock_id is None, the image will be hidden. gtk.Tooltip.set_markup set_markup markup markup : A markup string (see Pango markup format) or None. This method is available in PyGTK 2.12 and above. The set_markup() method sets the text of the tooltip to be markup, which is marked up with the Pango text markup language. If markup is None, the label will be hidden. gtk.Tooltip.set_text set_text text text : A text string or None. This method is available in PyGTK 2.12 and above. The set_text() method sets the text of the tooltip to be text. If text is None, the label will be hidden. See also set_markup. Functions gtk.tooltip_trigger_tooltip_query tooltip_trigger_tooltip_query display display : A gtk.gdk.Display This function is available in PyGTK 2.12 and above. The tooltip_trigger_tooltip_query() function triggers a new tooltip query on display, in order to update the current visible tooltip, or to show/hide the current tooltip. This function is useful to call when, for example, the state of the widget changed by a key press.