Hyperlink wxPhthon Ultimatelistctrl超链接示例代码
我需要使用Ultimatelistctrl来创建带有超行的图标 在Ultimatelistctrl API中,它提到 超链接类型的项目和子项目:它们看起来像一个超链接,适当的鼠标光标悬停; 但没有工作样本 我创建下面的渲染代码。DrawSubItem函数称为success。但是OnMouseEvent永远不会被调用。 如何将用户单击绑定到OnMouseEvent函数 类CustomizedRenderObject:Hyperlink wxPhthon Ultimatelistctrl超链接示例代码,hyperlink,wxpython,Hyperlink,Wxpython,我需要使用Ultimatelistctrl来创建带有超行的图标 在Ultimatelistctrl API中,它提到 超链接类型的项目和子项目:它们看起来像一个超链接,适当的鼠标光标悬停; 但没有工作样本 我创建下面的渲染代码。DrawSubItem函数称为success。但是OnMouseEvent永远不会被调用。 如何将用户单击绑定到OnMouseEvent函数 类CustomizedRenderObject: def __init__(self, parent, fileName):
def __init__(self, parent, fileName):
self.parent = parent
self.fileName = fileName
self.normalFont = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)
self.normalFont.SetPointSize(self.normalFont.GetPointSize() + 1)
self.smallerFont = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)
self.greyColour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT)
fileType = wx.TheMimeTypesManager.GetFileTypeFromExtension(extension)
bmp = wx.Bitmap(os.path.join(bitmapDir, "empty_icon.png"), wx.BITMAP_TYPE_PNG)
bmp = wx.IconFromBitmap(bmp)
self.icon = bmp
self.description = convert(fileType.GetDescription())
def OnMouseEvent(self, e):
if e.LeftUp():
webbrowser.open_new("http://www.google.com")
e.Skip()
def DrawSubItem(self, dc, rect, line, highlighted, enabled):
***********************
def GetLineHeight(self):
***********************
def GetSubItemWidth(self):
***********************
我可以在更改C:\Python27\Lib\site packages\wx-2.9.5-msw\wx\Lib\agw\ultimatelistctrl.py后使其工作
更改是在ultimatelistctrl.py onMouse上添加一些逻辑,然后调用您的模块代码