Python wx.html中的超链接—如何在同一html页面中导航
我使用wx.html在wxpython中创建了一个带有帮助菜单项的菜单。我使用以下代码:Python wx.html中的超链接—如何在同一html页面中导航,python,wxpython,wxwidgets,wxhtmlwindow,Python,Wxpython,Wxwidgets,Wxhtmlwindow,我使用wx.html在wxpython中创建了一个带有帮助菜单项的菜单。我使用以下代码: class AboutDlg(wx.Frame): def __init__(self, parent): wx.Frame.__init__(self, parent, wx.ID_ANY, title="About", size=(400,400)) html = wxHTML(self) html
class AboutDlg(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, wx.ID_ANY, title="About", size=(400,400))
html = wxHTML(self)
html.SetPage(
''
"<h2>About the About Tutorial</h2>"
"<p>This about box is for demo purposes only. It was created in June 2006"
"by Mike Driscoll.</p>"
"<p><b>Software used in making this demo:</h3></p>"
'<p><b><a href="http://www.python.org">Python 2.4</a></b></p>'
'<p><b><a href="http://www.wxpython.org">wxPython 2.8</a></b></p>'
)
class wxHTML(wx.html.HtmlWindow):
def OnLinkClicked(self, link):
webbrowser.open(link.GetHref())
class AboutDlg(wx.Frame):
定义初始化(自身,父级):
wx.Frame.\uuuu init\uuuuuuuuuuu(self,parent,wx.ID\u ANY,title=“About”,size=(400400))
html=wxHTML(self)
html.SetPage(
''
“关于关于教程”
“此“关于”框仅用于演示。它创建于2006年6月”
“作者:迈克·德里斯科尔。”
“制作此演示所用的软件:”
“”
“”
)
类wxHTML(wx.html.HtmlWindow):
def OnLinkClicked(自我,链接):
webbrowser.open(link.GetHref())
我找到密码了
当我点击其中一个超链接时,我想转到我创建的另一个html类
示例:单击Python2.4链接转到名为Python的html类
我希望有人能理解我要创建的内容。谢谢。好吧,在OnLinkClicked方法中,去掉webbrowser的东西,并输入自定义代码。我想您只需要创建另一个HTML字符串,然后再次调用SetPage或类似的东西。或者你可以看看wxPython 2.9中的WebView内容,它比HtmlWindow支持的内容要多得多。好吧,在OnLinkClicked方法中,去掉webbrowser内容并加入自定义代码。我想您只需要创建另一个HTML字符串,然后再次调用SetPage或类似的东西。或者你可以看看wxPython 2.9中的WebView内容,它支持的内容比HtmlWindow要多得多。我想做这个,我想做这个。