gtk.Tooltip — Add tips to your widgets (new in PyGTK 2.12)
class gtk.Tooltip( |
Functions
def gtk.tooltip_trigger_tooltip_query(display
)
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:
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.
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.
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:
gtk.Widget.set_tooltip_window
()
to set a gtk.Window
created by you as tooltip window.
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.
def set_custom(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
.
def get_value(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.
def set_icon_from_icon_name(icon_name
, size
)
| an icon name, or None . |
| 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.
def set_icon_from_stock(stock_id
, size
)
| A stock icon name, or None . |
| 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.
def set_icon_from_gicon(gicon
, size
)
| the icon to set, or None .. |
| a stock icon size. |
This method is available in PyGTK 2.22 and above.
The set_icon_from_gicon
() method sets the icon of the
tooltip (which is in front of the text) to be the icon indicated by gicon
with the size indicated by size
. If gicon is None
,
the image will be hidden.
def set_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.
def set_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
.
def tooltip_trigger_tooltip_query(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.