):
def set_custom(widget
)
def set_icon(pixbuf
)
def set_icon_from_icon_name(icon_name
, size
)
def set_icon_from_stock(stock_id
, size
)
def set_markup(markup
)
def set_text(text
)
Functions
def gtk.tooltip_trigger_tooltip_query(display
)
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:
Methods
gtk.Tooltip.set_custom
def set_custom(widget
)
Note
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
def get_value(pixbuf
)
Note
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
def set_icon_from_icon_name(icon_name
, size
)
icon_name :
| an icon name, or None . |
size :
| A stock icon size. |
Note
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
def set_icon_from_stock(stock_id
, size
)
stock_id :
| A stock icon name, or None . |
size :
| A stock icon size. |
Note
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
def set_markup(markup
)
markup :
| A markup string (see Pango markup format)
or None . |
Note
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
def set_text(text
)
text :
| A text string or None . |
Note
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
def tooltip_trigger_tooltip_query(display
)
Note
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.