]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-16/html_help.py
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)
35 def _addBook(filename
):
36 if not self
.help.AddBook(filename
):
37 wx
.MessageBox("Unable to open: " + filename
,
38 "Error", wx
.OK|wx
.ICON_EXCLAMATION
)
40 self
.help = wx
.html
.HtmlHelpController()
42 _addBook("helpfiles/testing.hhp")
43 _addBook("helpfiles/another.hhp")
46 def OnShowHelpContents(self
, evt
):
47 self
.help.DisplayContents()
49 def OnShowHelpIndex(self
, evt
):
50 self
.help.DisplayIndex()
52 def OnShowSpecificHelp(self
, evt
):
53 self
.help.Display("sub book")
56 app
= wx
.PySimpleApp()
57 frm
= MyHtmlFrame(None, "HTML Help")