I am toying with wx.html.HtmlHelpController and I just found out that “Initialize” doesn’t work at all…
class MainFrame(wx.Frame): def __init__(self, *args, **kwargs): wx.Frame.__init__(self, *args, **kwargs) self.Bind(wx.EVT_HELP, self.on_help) def on_help(self, event): # just press "F1" to see the help window wx.GetApp().help_controller.DisplayContents() class MyApp(wx.App): def OnInit(self): wx.FileSystem.AddHandler(wx.ArchiveFSHandler()) self.help_controller = wx.html.HtmlHelpController() self.help_controller.Initialize('test.zip') # this won't work # self.help_controller.AddBook('test.zip') # this works fine MainFrame(None).Show() return True MyApp().MainLoop()
If you need a zip file to try this snippet, you may use the “test.zip” documentation sample from the wxWidgets repo: https://github.com/wxWidgets/wxWidgets/blob/c42715f0c9defc0834e78e7d68158163845b4c81/samples/html/helpview/test.zip
Now, if you try the “Initialize” API, it doesn’t load the docs into the help window. But, if you try “AddBook” instead, everything works as expected.
This seems a bit funny because “Initialize” will just end up calling “AddBook” anyways… see https://github.com/wxWidgets/wxWidgets/blob/c42715f0c9defc0834e78e7d68158163845b4c81/src/html/helpctrl.cpp#L269
I have a little hesitation in opening a ticket at wxWidgets’, because it seems very odd that nobody noticed such an obvious bug in a code that is now 20 years old… I think I am missing something here…
Could someone please test and confirm this for me? (I’m running the latest nightly build of wxPython on my windows box, but it should be platform-independent…)
Thanks a lot