import wx
import wx.html
class MyHtmlFrame(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, -1, title)
p = wx.Panel(self)
b1 = wx.Button(p, -1, "Show Help Contents")
self.Bind(wx.EVT_BUTTON, self.OnShowHelpContents, b1)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add((10,10))
sizer.Add(b1, 0, wx.ALL, 10)
p.SetSizer(sizer)
self.InitHelp()
def InitHelp(self):
def _addBook(filename):
if not self.help.AddBook(filename):
wx.MessageBox("Unable to open: " + filename,"Error", wx.OK|wx.ICON_EXCLAMATION)
self.help = wx.html.HtmlHelpController()
_addBook("testing.hhp")
def OnShowHelpContents(self, evt):
self.help.DisplayContents()
self.help.DisplayIndex()
self.help.Display("sub book")
app = wx.PySimpleApp()
frm = MyHtmlFrame(None, "HTML Help")
frm.Show()
app.MainLoop()