2
wxPython can use html files for online help or other forms of
3
documentation for your application. The help can be organized as a
4
collection of books, and there is a help viewer available that enables
5
the user to browse by book, via an index or full text search. The
6
format of the contents and index files are similar to Microsoft
13
class MyHtmlFrame(wx.Frame):
14
def __init__(self, parent, title):
15
wx.Frame.__init__(self, parent, -1, title)
17
b1 = wx.Button(p, -1, "Show Help Contents")
18
b2 = wx.Button(p, -1, "Show Help Index")
19
b3 = wx.Button(p, -1, "Show Specific Help")
20
self.Bind(wx.EVT_BUTTON, self.OnShowHelpContents, b1)
21
self.Bind(wx.EVT_BUTTON, self.OnShowHelpIndex, b2)
22
self.Bind(wx.EVT_BUTTON, self.OnShowSpecificHelp, b3)
24
sizer = wx.BoxSizer(wx.VERTICAL)
26
sizer.Add(b1, 0, wx.ALL, 10)
27
sizer.Add(b2, 0, wx.ALL, 10)
28
sizer.Add(b3, 0, wx.ALL, 10)
32
self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
36
def _addBook(filename):
37
if not self.help.AddBook(filename):
38
wx.MessageBox("Unable to open: " + filename,
39
"Error", wx.OK|wx.ICON_EXCLAMATION)
41
self.help = wx.html.HtmlHelpController()
42
_addBook("helpfiles/testing.hhp")
43
_addBook("helpfiles/another.hhp")
46
def OnCloseWindow(self, evt):
50
def OnShowHelpContents(self, evt):
51
self.help.DisplayContents()
53
def OnShowHelpIndex(self, evt):
54
self.help.DisplayIndex()
56
def OnShowSpecificHelp(self, evt):
57
self.help.Display("sub book")
60
app = wx.PySimpleApp()
61
frm = MyHtmlFrame(None, "HTML Help")