HyperLinkCtrl is a control for wxPython that acts like a hyper link in a typical browser.
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.
Special thanks to Robin Dunn for the event binder for the 3 mouse buttons.
Usage example:
import wx
import wx.lib.agw.hyperlink as hl
class MyFrame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, -1, "HyperLink Demo")
panel = wx.Panel(self, -1)
# Default Web links:
hyper1 = hl.HyperLinkCtrl(panel, -1, "wxPython Main Page", pos=(100, 100),
URL="http://www.wxpython.org/")
# Web link with underline rollovers, opens in same window
hyper2 = hl.HyperLinkCtrl(panel, -1, "My Home Page", pos=(100, 150),
URL="http://xoomer.virgilio.it/infinity77/")
hyper2.AutoBrowse(False)
hyper2.SetColours("BLUE", "BLUE", "BLUE")
hyper2.EnableRollover(True)
hyper2.SetUnderlines(False, False, True)
hyper2.SetBold(True)
hyper2.OpenInSameWindow(True)
hyper2.SetToolTip(wx.ToolTip("Hello World!"))
hyper2.UpdateLink()
# our normal wxApp-derived class, as usual
app = wx.PySimpleApp()
frame = MyFrame(None)
app.SetTopWindow(frame)
frame.Show()
app.MainLoop()
This code snippet can be downloaded, see this example script.
Note
Some of the AGW snippets of code in the documentation use images and external files (to create bitmaps or access external data). As these files are not provided in these snippets, you should make the approriate modifications to the code to actually run it.
This class processes the following events:
Event Name | Description |
---|---|
EVT_HYPERLINK_LEFT | Responds to a left mouse button event. Sent when the left mouse button is clicked, but only if AutoBrowse is set to False. |
EVT_HYPERLINK_MIDDLE | Responds to a middle mouse button event. Sent when the middle mouse button is clicked. |
EVT_HYPERLINK_RIGHT | Handles a right mouse button event. Sent when the right mouse button is clicked, but only if DoPopup is set to False. |
HyperLinkCtrl is distributed under the wxPython license.
Latest Revision: Andrea Gavana @ 17 Aug 2011, 15.00 GMT
Version 0.6
Module author: Andrea Gavana <andrea.gavana@gmail.com>
A graphical representation of the SVN commits in the last year.
Click on any date in the picture to jump to that particular revision page, containing information about committers, log messages and SVN diffs.
Revision Graph For hyperlink