views:

61

answers:

1

I have a project set up as a notebook layout using wxpython. I am trying to create a help panel. The HtmlWindow object doesn't display the html page on the panel. No errors are displayed and a call to HtmlWindow.GetOpenedPage() returns the page name.

import wx
import wx.html as html

class HelpPanel(wx.Panel):
    def __init__(self, parent, id):
        wx.Panel.__init__(self, parent, id)
        self.panel = wx.Panel(self, -1)
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.help = html.HtmlWindow(self.panel, -1, style=wx.NO_BORDER)
        self.help.LoadFile('help.html')
        self.sizer.Add(self.help)
        self.panel.SetSizer(self.sizer)
        self.Show(True)

    def add_help_panel(self, parent, evt):
        self.help_panel = HelpPanel(parent, -1)
        parent.AddPage(self.help_panel, 'Help')
        parent.SetSelection(parent.GetPageCount()-1)

Here is the call from the menu to open the HelpPanel:

wx.EVT_MENU(self, ID_HELP, lambda evt: help.HelpPanel.add_help_panel(help.HelpPanel(self.nb, -1), self.nb, evt))
A: 

I think the problem may be how your adding your HtmlWindow object to your sizer, try and setting the EXPAND flag and the proportion to 1.

self.sizer.Add(self.help, 1, wx.EXPAND)
volting
Unfortunately it doesn't fix the problem.
Doug
@Doug: Consider adding a runnable sample of the problem to your question, it will make it easier for someone to diagnose your problem, otherwise its a guessing game.
volting