
wx.lib.agw.hyperlink.HyperLinkCtrl¶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¶
Inheritance diagram for class HyperLinkCtrl:

Control Appearance¶
wxMSW¶
wxMAC¶
wxGTK¶
Known Superclasses¶
Methods Summary¶Default class constructor. |
|
Automatically browse to URL when clicked. |
|
Displays an error message (according to the ReportErrors parameter) in a |
|
Sets whether to show popup menu on right click or not. |
|
Enable/disable rollover. |
|
Returns whether the |
|
Gets the colours for the link, the visited link and the mouse |
|
Gets the link cursor. |
|
Returns if link is underlined, if the mouse rollover is |
|
Retrieve the URL associated to the |
|
Returns whether a link has been visited or not. |
|
Goto the specified URL. |
|
Handles the |
|
Handles the |
|
Open multiple URL in the same window (if possible). |
|
Set whether to report browser errors or not. |
|
Sets the |
|
Sets the colours for the link, the visited link and the mouse rollover. |
|
Sets link cursor properties. |
|
Sets whether the text should be underlined or not for new links, visited |
|
Sets the |
|
Sets a link as visited. |
|
Updates the link, changing text properties if |
Class API¶HyperLinkCtrl(StaticText)¶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.
__init__(self, parent, id=-1, label="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, name="staticText", URL="")¶Default class constructor.
parent – the window parent. Must not be None;
id – window identifier. A value of -1 indicates a default value;
label – the control label;
pos – the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform;
size – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform;
style – the window style;
name – the window name;
URL – a string specifying the url link to navigate to.
Note
Pass URL=”” to use the label as the url link to navigate to.
AutoBrowse(self, AutoBrowse=True)¶Automatically browse to URL when clicked.
AutoBrowse – True to automatically browse to an URL when clicked,
False otherwise.
Note
Set AutoBrowse to False to receive EVT_HYPERLINK_LEFT events.
DisplayError(self, ErrorMessage, ReportErrors=True)¶Displays an error message (according to the ReportErrors parameter) in a
MessageBox.
ErrorMessage – a string representing the error to display;
ReportErrors – True to display error dialog if an error occurs
navigating to the URL.
DoPopup(self, DoPopup=True)¶Sets whether to show popup menu on right click or not.
DoPopup – True to show a popup menu on right click, False otherwise.
EnableRollover(self, EnableRollover=False)¶Enable/disable rollover.
EnableRollover – True to enable text effects during rollover,
False to disable them.
GetBold(self)¶Returns whether the HyperLinkCtrl has text in bold or not.
GetColours(self)¶Gets the colours for the link, the visited link and the mouse rollover.
GetLinkCursor(self)¶Gets the link cursor.
GetUnderlines(self)¶Returns if link is underlined, if the mouse rollover is underlined and if the visited link is underlined.
GetURL(self)¶Retrieve the URL associated to the HyperLinkCtrl.
GetVisited(self)¶Returns whether a link has been visited or not.
GotoURL(self, URL, ReportErrors=True, NotSameWinIfPossible=False)¶Goto the specified URL.
URL – the url link we wish to navigate;
ReportErrors – Use True to display error dialog if an error
occurs navigating to the URL;
NotSameWinIfPossible – Use True to attempt to open the URL
in new browser window.
OnMouseEvent(self, event)¶Handles the wx.EVT_MOUSE_EVENTS events for HyperLinkCtrl.
event – a MouseEvent event to be processed.
OnPopUpCopy(self, event)¶Handles the wx.EVT_MENU event for HyperLinkCtrl.
event – a wx.MenuEvent event to be processed.
Note
This method copies the data from the HyperLinkCtrl to the clipboard.
OpenInSameWindow(self, NotSameWinIfPossible=False)¶Open multiple URL in the same window (if possible).
NotSameWinIfPossible – True to open an hyperlink in a new browser
window, False to use an existing browser window.
ReportErrors(self, ReportErrors=True)¶Set whether to report browser errors or not.
ReportErrors – Use True to display error dialog if an error
occurs navigating to the URL;
SetBold(self, Bold=False)¶Sets the HyperLinkCtrl label in bold text.
Bold – True to set the HyperLinkCtrl label as bold, False
otherwise.
SetColours(self, link=wx.BLUE, visited=wx.Colour(79, 47, 79), rollover=wx.BLUE)¶Sets the colours for the link, the visited link and the mouse rollover.
Visited link: VIOLET
Rollover: BLUE
SetLinkCursor(self, cur=wx.CURSOR_HAND)¶Sets link cursor properties.
cur – an integer representing a Cursor constant.
SetUnderlines(self, link=True, visited=True, rollover=True)¶Sets whether the text should be underlined or not for new links, visited links and rollovers.
link – True to set the text of new links as underlined, False
otherwise;
visited – True to set the text of visited links as underlined,
False otherwise;
rollover – True to set the text of rollovers as underlined,
False otherwise.
SetURL(self, URL)¶Sets the HyperLinkCtrl text to the specified URL.
URL – the new URL associated with HyperLinkCtrl.
SetVisited(self, Visited=False)¶Sets a link as visited.
Visited – True to set a link as visited, False otherwise.
UpdateLink(self, OnRefresh=True)¶Updates the link, changing text properties if:
User specific setting;
Link visited;
New link;
OnRefresh – True to refresh the control, False otherwise.