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 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333
|
.. 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
.. currentmodule:: wx.lib.agw.hyperlink
.. highlight:: python
.. _wx.lib.agw.hyperlink.HyperLinkCtrl:
==========================================================================================================================================
|phoenix_title| **wx.lib.agw.hyperlink.HyperLinkCtrl**
==========================================================================================================================================
:class:`HyperLinkCtrl` is a control for wxPython that acts like a hyper
link in a typical browser. Latest features include the ability to
capture your own left, middle, and right click events to perform
your own custom event handling and ability to open link in a new
or current browser window.
|
|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>HyperLinkCtrl</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.lib.agw.hyperlink.HyperLinkCtrl_inheritance.png" alt="Inheritance diagram of HyperLinkCtrl" 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.lib.stattext.GenStaticText.html" title="wx.lib.stattext.GenStaticText" alt="" coords="20,392,223,421"/> <area shape="rect" id="node8" href="wx.lib.agw.hyperlink.HyperLinkCtrl.html" title="wx.lib.agw.hyperlink.HyperLinkCtrl" alt="" coords="4,469,237,499"/> <area shape="rect" id="node2" href="wx.Control.html" title="wx.Control" alt="" coords="77,315,165,344"/> <area shape="rect" id="node3" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="13,5,115,35"/> <area shape="rect" id="node4" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="65,83,176,112"/> <area shape="rect" id="node6" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="61,160,181,189"/> <area shape="rect" id="node5" href="wx.Object.html" title="wx.Object" alt="" coords="139,5,220,35"/> <area shape="rect" id="node7" href="wx.Window.html" title="wx.Window" alt="" coords="77,237,165,267"/> </map>
</p>
|
|appearance| Control Appearance
===============================
|
.. figure:: _static/images/widgets/fullsize/wxmsw/wx.lib.agw.hyperlink.hyperlinkctrl.png
:alt: wxMSW
:figclass: floatleft
**wxMSW**
.. figure:: _static/images/widgets/fullsize/wxmac/../no_appearance.png
:alt: wxMAC
:figclass: floatright
**wxMAC**
.. figure:: _static/images/widgets/fullsize/wxgtk/../no_appearance.png
:alt: wxGTK
:figclass: floatcenter
**wxGTK**
|
|super_classes| Known Superclasses
==================================
:class:`wx.lib.stattext.GenStaticText`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.__init__` Default class constructor.
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.AutoBrowse` Automatically browse to URL when clicked.
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.DisplayError` Displays an error message (according to the `ReportErrors` parameter) in a
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.DoPopup` Sets whether to show popup menu on right click or not.
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.EnableRollover` Enable/disable rollover.
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.GetBold` Returns whether the :class:`HyperLinkCtrl` has text in bold or not.
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.GetColours` Gets the colours for the link, the visited link and the mouse
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.GetLinkCursor` Gets the link cursor.
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.GetUnderlines` Returns if link is underlined, if the mouse rollover is
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.GetURL` Retrieve the URL associated to the :class:`HyperLinkCtrl`.
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.GetVisited` Returns whether a link has been visited or not.
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.GotoURL` Goto the specified URL.
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.OnMouseEvent` Handles the ``wx.EVT_MOUSE_EVENTS`` events for :class:`HyperLinkCtrl`.
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.OnPopUpCopy` Handles the ``wx.EVT_MENU`` event for :class:`HyperLinkCtrl`.
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.OpenInSameWindow` Open multiple URL in the same window (if possible).
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.ReportErrors` Set whether to report browser errors or not.
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.SetBold` Sets the :class:`HyperLinkCtrl` label in bold text.
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.SetColours` Sets the colours for the link, the visited link and the mouse rollover.
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.SetLinkCursor` Sets link cursor properties.
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.SetUnderlines` Sets whether the text should be underlined or not for new links, visited
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.SetURL` Sets the :class:`HyperLinkCtrl` text to the specified URL.
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.SetVisited` Sets a link as visited.
:meth:`~wx.lib.agw.hyperlink.HyperLinkCtrl.UpdateLink` Updates the link, changing text properties if
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: HyperLinkCtrl(StaticText)
:class:`HyperLinkCtrl` is a control for wxPython that acts like a hyper
link in a typical browser. Latest features include the ability to
capture your own left, middle, and right click events to perform
your own custom event handling and ability to open link in a new
or current browser window.
.. method:: __init__(self, parent, id=-1, label="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, name="staticText", URL="")
Default class constructor.
:param `parent`: the window parent. Must not be ``None``;
:param `id`: window identifier. A value of -1 indicates a default value;
:param `label`: the control label;
:param `pos`: the control position. A value of (-1, -1) indicates a default position,
chosen by either the windowing system or wxPython, depending on platform;
:param `size`: the control size. A value of (-1, -1) indicates a default size,
chosen by either the windowing system or wxPython, depending on platform;
:param `style`: the window style;
:param `name`: the window name;
:param `URL`: a string specifying the url link to navigate to.
:note: Pass URL="" to use the label as the url link to navigate to.
.. method:: AutoBrowse(self, AutoBrowse=True)
Automatically browse to URL when clicked.
:param `AutoBrowse`: ``True`` to automatically browse to an URL when clicked,
``False`` otherwise.
:note: Set `AutoBrowse` to ``False`` to receive ``EVT_HYPERLINK_LEFT`` events.
.. method:: DisplayError(self, ErrorMessage, ReportErrors=True)
Displays an error message (according to the `ReportErrors` parameter) in a
:class:`MessageBox`.
:param `ErrorMessage`: a string representing the error to display;
:param `ReportErrors`: ``True`` to display error dialog if an error occurrs
navigating to the URL.
.. method:: DoPopup(self, DoPopup=True)
Sets whether to show popup menu on right click or not.
:param `DoPopup`: ``True`` to show a popup menu on right click, ``False`` otherwise.
.. method:: EnableRollover(self, EnableRollover=False)
Enable/disable rollover.
:param `EnableRollover`: ``True`` to enable text effects during rollover,
``False`` to disable them.
.. method:: GetBold(self)
Returns whether the :class:`HyperLinkCtrl` has text in bold or not.
.. method:: GetColours(self)
Gets the colours for the link, the visited link and the mouse
rollover.
.. method:: GetLinkCursor(self)
Gets the link cursor.
.. method:: GetUnderlines(self)
Returns if link is underlined, if the mouse rollover is
underlined and if the visited link is underlined.
.. method:: GetURL(self)
Retrieve the URL associated to the :class:`HyperLinkCtrl`.
.. method:: GetVisited(self)
Returns whether a link has been visited or not.
.. method:: GotoURL(self, URL, ReportErrors=True, NotSameWinIfPossible=False)
Goto the specified URL.
:param `URL`: the url link we wish to navigate;
:param `ReportErrors`: Use ``True`` to display error dialog if an error
occurrs navigating to the URL;
:param `NotSameWinIfPossible`: Use ``True`` to attempt to open the URL
in new browser window.
.. method:: OnMouseEvent(self, event)
Handles the ``wx.EVT_MOUSE_EVENTS`` events for :class:`HyperLinkCtrl`.
:param `event`: a :class:`MouseEvent` event to be processed.
.. method:: OnPopUpCopy(self, event)
Handles the ``wx.EVT_MENU`` event for :class:`HyperLinkCtrl`.
:param `event`: a :class:`wx.MenuEvent` event to be processed.
:note: This method copies the data from the :class:`HyperLinkCtrl` to the clipboard.
.. method:: OpenInSameWindow(self, NotSameWinIfPossible=False)
Open multiple URL in the same window (if possible).
:param `NotSameWinIfPossible`: ``True`` to open an hyperlink in a new browser
window, ``False`` to use an existing browser window.
.. method:: ReportErrors(self, ReportErrors=True)
Set whether to report browser errors or not.
:param `ReportErrors`: Use ``True`` to display error dialog if an error
occurrs navigating to the URL;
.. method:: SetBold(self, Bold=False)
Sets the :class:`HyperLinkCtrl` label in bold text.
:param `Bold`: ``True`` to set the :class:`HyperLinkCtrl` label as bold, ``False``
otherwise.
.. method:: SetColours(self, link=wx.Colour(0, 0, 255), visited=wx.Colour(79, 47, 79), rollover=wx.Colour(0, 0, 255))
Sets the colours for the link, the visited link and the mouse rollover.
- Visited link: VIOLET
- Rollover: BLUE
:param `link`: a valid :class:`wx.Colour` to use as text foreground for new links
(default=RED);
:param `visited`: a valid :class:`wx.Colour` to use as text foreground for visited
links (default=VIOLET);
:param `rollover`: a valid :class:`wx.Colour` to use as text foreground for links
rollovers (default=BLUE).
.. method:: SetLinkCursor(self, cur=wx.CURSOR_HAND)
Sets link cursor properties.
:param `cur`: an integer representing a :ref:`Cursor` constant.
.. method:: SetUnderlines(self, link=True, visited=True, rollover=True)
Sets whether the text should be underlined or not for new links, visited
links and rollovers.
:param `link`: ``True`` to set the text of new links as underlined, ``False``
otherwise;
:param `visited`: ``True`` to set the text of visited links as underlined,
``False`` otherwise;
:param `rollover`: ``True`` to set the text of rollovers as underlined,
``False`` otherwise.
.. method:: SetURL(self, URL)
Sets the :class:`HyperLinkCtrl` text to the specified URL.
:param `URL`: the new URL associated with :class:`HyperLinkCtrl`.
.. method:: SetVisited(self, Visited=False)
Sets a link as visited.
:param `Visited`: ``True`` to set a link as visited, ``False`` otherwise.
.. method:: UpdateLink(self, OnRefresh=True)
Updates the link, changing text properties if:
- User specific setting;
- Link visited;
- New link;
:param `OnRefresh`: ``True`` to refresh the control, ``False`` otherwise.
|