same code, different results frame / dialog

i have the following code that works fine as a frame (the panels
expand left to right, but as a dialog the two panels are along the
left edge and do not span completely to the right.

        # panels
        panelMain = wx.Panel(self, wx.ID_ANY)
        panelTable = wx.Panel(panelMain, wx.ID_ANY)
        panelNavigate = wx.Panel(panelMain, wx.ID_ANY)
        panelNavigate.SetBackgroundColour('gray')

        btn = wx.Button(panelNavigate, wx.ID_OK, "okay")
        boxSizerMain = wx.BoxSizer(wx.VERTICAL)
        boxSizerMain.Add(panelTable, 1, wx.ALIGN_TOP | wx.EXPAND)
        boxSizerMain.Add(panelNavigate, 0, wx.ALIGN_BOTTOM |
wx.EXPAND)
        panelMain.SetSizerAndFit(boxSizerMain)
        panelMain.Layout()

is there something different i need to do for a dialog?

thank you,
bob k.

If the frame has only one child then the frame will expand that child, so adding something like this should do the trick with your dialog.

         diagSizer = wx.BoxSizer(wx.VERTICAL)
         diagSizer.Add(panelMain, proportion=1, flag=wx.EXPAND)
         self.SetSizer(diagSizer)
         self.Layout()

Werner

···

On 06/20/2011 02:10 AM, BobK wrote:

i have the following code that works fine as a frame (the panels
expand left to right, but as a dialog the two panels are along the
left edge and do not span completely to the right.

         # panels
         panelMain = wx.Panel(self, wx.ID_ANY)
         panelTable = wx.Panel(panelMain, wx.ID_ANY)
         panelNavigate = wx.Panel(panelMain, wx.ID_ANY)
         panelNavigate.SetBackgroundColour('gray')

         btn = wx.Button(panelNavigate, wx.ID_OK, "okay")
         boxSizerMain = wx.BoxSizer(wx.VERTICAL)
         boxSizerMain.Add(panelTable, 1, wx.ALIGN_TOP | wx.EXPAND)
         boxSizerMain.Add(panelNavigate, 0, wx.ALIGN_BOTTOM |
wx.EXPAND)
         panelMain.SetSizerAndFit(boxSizerMain)
         panelMain.Layout()

is there something different i need to do for a dialog?

Thank you Werner.

···

On Jun 20, 6:13 am, werner <wbru...@free.fr> wrote:

On 06/20/2011 02:10 AM, BobK wrote:

> i have the following code that works fine as a frame (the panels
> expand left to right, but as a dialog the two panels are along the
> left edge and do not span completely to the right.

> # panels
> panelMain = wx.Panel(self, wx.ID_ANY)
> panelTable = wx.Panel(panelMain, wx.ID_ANY)
> panelNavigate = wx.Panel(panelMain, wx.ID_ANY)
> panelNavigate.SetBackgroundColour('gray')

> btn = wx.Button(panelNavigate, wx.ID_OK, "okay")
> boxSizerMain = wx.BoxSizer(wx.VERTICAL)
> boxSizerMain.Add(panelTable, 1, wx.ALIGN_TOP | wx.EXPAND)
> boxSizerMain.Add(panelNavigate, 0, wx.ALIGN_BOTTOM |
> wx.EXPAND)
> panelMain.SetSizerAndFit(boxSizerMain)
> panelMain.Layout()

> is there something different i need to do for a dialog?

If the frame has only one child then the frame will expand that child,
so adding something like this should do the trick with your dialog.

     diagSizer = wx\.BoxSizer\(wx\.VERTICAL\)
     diagSizer\.Add\(panelMain, proportion=1, flag=wx\.EXPAND\)
     self\.SetSizer\(diagSizer\)
     self\.Layout\(\)

Werner- Hide quoted text -

- Show quoted text -