1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.adv.RichToolTip:
==========================================================================================================================================
|phoenix_title| **wx.adv.RichToolTip**
==========================================================================================================================================
Allows to show a tool tip with more customizations than :ref:`wx.ToolTip`.
Using this class is very simple, to give a standard warning for a password text control if the password was entered correctly you could simply do: ::
password = wx.TextCtrl(parent, style=wx.TE_PASSWORD)
# Later on...
tip = wx.adv.RichToolTip("Caps Lock is on",
"You might have made an error in your password\n"
"entry because Caps Lock is turned on.\n"
"\n"
"Press Caps Lock key to turn it off.")
tip.SetIcon(wx.ICON_WARNING)
tip.ShowFor(password)
Currently this class has generic implementation that can be used with any window and implements all the functionality but doesn't exactly match the appearance of the native tooltips (even though it makes some efforts to use the style most appropriate for the current platform) and a native MSW version which can be only used with text controls and doesn't provide as much in the way of customization. Because of this, it's inadvisable to customize the tooltips unnecessarily as doing this turns off auto-detection of the native style in the generic version and may prevent the native MSW version from being used at all.
Notice that this class is not derived from :ref:`wx.Window` and hence doesn't represent a window, even if its :meth:`~wx.adv.RichToolTip.ShowFor` method does create one internally to show the tooltip.
The images below show some examples of rich tooltips on different platforms, with various customizations applied.
.. versionadded:: 2.9.3
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>RichToolTip</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.adv.RichToolTip_inheritance.png" alt="Inheritance diagram of RichToolTip" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.adv.RichToolTip.html" title="wx.adv.RichToolTip" alt="" coords="4,5,139,35"/> </map>
</p>
|
|appearance| Control Appearance
===============================
|
.. figure:: _static/images/widgets/fullsize/wxmsw/wx.adv.richtooltip.png
:alt: wxMSW
:figclass: floatleft
**wxMSW**
.. figure:: _static/images/widgets/fullsize/wxmac/wx.adv.richtooltip.png
:alt: wxMAC
:figclass: floatright
**wxMAC**
.. figure:: _static/images/widgets/fullsize/wxgtk/wx.adv.richtooltip.png
:alt: wxGTK
:figclass: floatcenter
**wxGTK**
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.adv.RichToolTip.__init__` Constructor must specify the tooltip title and main message.
:meth:`~wx.adv.RichToolTip.SetBackgroundColour` Set the background colour.
:meth:`~wx.adv.RichToolTip.SetIcon` Set the small icon to show.
:meth:`~wx.adv.RichToolTip.SetTimeout` Set timeout after which the tooltip should disappear and optionally set a delay before the tooltip is shown, in milliseconds.
:meth:`~wx.adv.RichToolTip.SetTipKind` Choose the tip kind, possibly none.
:meth:`~wx.adv.RichToolTip.SetTitleFont` Set the title text font.
:meth:`~wx.adv.RichToolTip.ShowFor` Show the tooltip for the given window and optionally specify where to show the tooltip.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.adv.RichToolTip(object)
**Possible constructors**::
RichToolTip(title, message)
Allows to show a tool tip with more customizations than ToolTip.
.. method:: __init__(self, title, message)
Constructor must specify the tooltip title and main message.
The main message can contain embedded new lines. Both the title and message must be non-empty.
Additional attributes can be set later.
:param `title`:
:type `title`: string
:param `message`:
:type `message`: string
.. method:: SetBackgroundColour(self, col, colEnd=Colour())
Set the background colour.
If two colours are specified, the background is drawn using a gradient from top to bottom, otherwise a single solid colour is used.
By default the colour or colours most appropriate for the current platform are used. If a colour is explicitly set, native MSW version won't be used as it doesn't support setting the colour.
:param `col`:
:type `col`: wx.Colour
:param `colEnd`:
:type `colEnd`: wx.Colour
.. method:: SetIcon(self, *args, **kw)
Set the small icon to show.
The icon can be either one of the standard information/warning/error ones, i.e. ``wx.ICON_INFORMATION``, ``wx.ICON_WARNING`` or ``wx.ICON_ERROR`` respectively (the question icon doesn't make sense for a tooltip so ``wx.ICON_QUESTION`` can't be used here) or a custom icon. The latter is unsupported by the native MSW implementation of this class so the use of a standard icon is preferred.
|overload| Overloaded Implementations:
**~~~**
**SetIcon** `(self, icon=ICON_INFORMATION)`
:param `icon`:
:type `icon`: int
**~~~**
**SetIcon** `(self, icon)`
:param `icon`:
:type `icon`: wx.Icon
**~~~**
.. method:: SetTimeout(self, millisecondsTimeout, millisecondsDelay=0)
Set timeout after which the tooltip should disappear and optionally set a delay before the tooltip is shown, in milliseconds.
By default the tooltip is shown immediately and hidden after a system-dependent interval of time elapses. This method can be used to change this or also disable hiding the tooltip automatically entirely by passing 0 in this parameter (but doing this will prevent the native MSW version from being used).
Notice that the tooltip will always be hidden if the user presses a key or clicks a mouse button.
Parameter `millisecondsDelay` is new since wxWidgets 2.9.5.
:param `millisecondsTimeout`:
:param `millisecondsDelay`:
.. method:: SetTipKind(self, tipKind)
Choose the tip kind, possibly none.
See TipKind documentation for the possible choices here.
By default the tip is positioned automatically, as if TipKind_Auto was used. Native MSW implementation doesn't support setting the tip kind explicitly and won't be used if this method is called with any value other than TipKind_Auto.
Notice that using non automatic tooltip kind may result in the tooltip being positioned partially off screen and it's the callers responsibility to ensure that this doesn't happen in this case.
:param `tipKind`:
:type `tipKind`: wx.adv.TipKind
.. method:: SetTitleFont(self, font)
Set the title text font.
By default it's emphasized using the font style or colour appropriate for the current platform. Calling this method prevents the native MSW implementation from being used as it doesn't support changing the font.
:param `font`:
:type `font`: wx.Font
.. method:: ShowFor(self, win, rect=None)
Show the tooltip for the given window and optionally specify where to show the tooltip.
By default the tooltip tip points to the (middle of the) specified window which must be non-NULL or, if `rect` is non-NULL, the middle of the specified :ref:`wx.Rect`.
The coordinates of the `rect` parameter are relative to the given window.
Currently the native MSW implementation is used only if `win` is a :ref:`wx.TextCtrl` and `rect` is ``None``. This limitation may be removed in the future.
Parameter `rect` is new since wxWidgets 2.9.5.
:param `win`:
:type `win`: wx.Window
:param `rect`:
:type `rect`: wx.Rect
|