Hi all,
I have a problem getting the controls on panels on my NoteBook pages to re-size when I re-size the Frame.
The MainFrame has a SplitterWindow
I create two panels for the SplitterWindow. leftPanel and rightPanel. They both have BoxSizers.
leftPanel has a TreeListControl and rightPanel has a NoteBook.
Then I add a panel to each page of the NoteBook.
Inside the Panels I have some staticText controls and on one I have three StaticBoxes with some controls in them.
How do I get the panels in the NoteBook to be able to scroll up and down if the Frame is smaller than the height of the panels in the pages?
I know I am missing some sizers somewhere, but I don’t where I should use the sizers. Do I need to use some StaticBoxSizers as well or Flexgridsizers in the Panels?
Here are snippets from my code:
class MyMenu(wx.Frame):
def _init_notebook_pages(self, parent):
# initialize the notrbook pages in the right pane
parent.AddPage(imageId=-1, page=self.panel_ne_id, select=True,
text="Page 1")
parent.AddPage(imageId=-1, page=self.panel_location_info, select=False,
text="Page 2")
def _init_right_panel(self):
rightPanel = wx.Panel(self.splitter, size=wx.Size(711, 345))
# Create the right box sizer that will contain the panel's contents
rightBox = wx.BoxSizer(wx.VERTICAL)
# Create a widget to display static text and store it in the right panel
self.notebook = wx.Notebook(id=wxID_MAINFRAMENOTEBOOK, parent=rightPanel)
# Notebook pages
# Yes, this one is in a different module that gets imported at the beginning
self.panel_ne_id = IdPanel.PanelNeId(id=wxID_NOTEBOOKPANELNEID,
name='Page_1', parent=self.notebook, pos=wx.Point(0, 0),
size=wx.Size(711, 345), style=wx.TAB_TRAVERSAL)
self.panel_location_info = wx.Panel(id=wxID_NOTEBOOKPANELLOCATIONINFO,
name='loc_info', parent=self.notebook, pos=wx.Point(0, 0),
size=wx.Size(711, 345), style=wx.TAB_TRAVERSAL)
def _init_ctrls(self, parent):
wx.Frame.__init__(self, id=-1, name=u'DataFrame',
parent=parent, pos=wx.Point(559, 17), size=wx.Size(1321, 1033),
style=wx.DEFAULT_FRAME_STYLE, title=u'my Frame')
self.splitter = wx.SplitterWindow(self)
# Create the left panel
leftPanel = self._init_left_panel()
# Create the right panel
rightPanel = self._init_right_panel()
# Put the left and right panes into the split window
self.splitter.SplitVertically(leftPanel, rightPanel, 300)
def __init__(self, parent):
self._init_ctrls(parent)