sizers and AuiNotebook

I am witting an application using the AuiManager and AuiNotebook.
Inside one page of the AuiNotebook I want to have two panels; the
first panel (at the left side with fixed width) will have some widgets
(buttons) and the other panel only a wx.grid.Grid.

The code below illustrates what I want but it doesn't work as I'd like.

I'd like to always see the grid scroll bars and the grid to be
maximized when the window is maximized.

I'd appreciate any help.

Thanks in advance

Marcos

···

#########################
import wx
import wx.aui
import wx.grid

class MainFrame(wx.Frame):
    def __init__(self, parent):
        wx.Frame.__init__(self, parent)
        #The AuiManager
        self._mgr = wx.aui.AuiManager( flags=wx.aui.AUI_MGR_DEFAULT )
        self._mgr.SetManagedWindow(self)
        #The window at the center
        PaneInfoCenter =
wx.aui.AuiPaneInfo().Center().MaximizeButton(True).MinSize((200,300))
        notebook = wx.aui.AuiNotebook( self, style =
wx.aui.AUI_NB_WINDOWLIST_BUTTON | wx.aui.AUI_NB_TAB_SPLIT )

        #The first page of the notebook:
        panel = wx.Panel(notebook)
        panelLeft = wx.Panel(panel, -1, size = (200,400))
        text = 'I''d like to see the grid scroll bars and the grid to
be maximized when the window is maximized.'
        wx.TextCtrl(panelLeft, -1, text, size = (200,400),
style=wx.TE_MULTILINE|wx.TE_PROCESS_ENTER)
        panelLeft.SetBackgroundColour(wx.WHITE)
        panelRight = wx.Panel(panel, -1, pos = (200,0), size = (400,400))
        grid = Grid(panelRight)

        #Sizer:
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(panelLeft, 0)
        sizer.Add(panelRight, 1, wx.EXPAND)
        panel.SetSizerAndFit(sizer)

        notebook.AddPage(panel, caption="Page1")

        #Other pages:
        notebook.AddPage(Grid(notebook), caption="Page2")
        notebook.AddPage(Grid(notebook), caption="Page3")

        self._mgr.AddPane( notebook, PaneInfoCenter )
        #Update the wxAUI manager
        self._mgr.Update()

class Grid(wx.grid.Grid):
    def __init__(self, parent):
        wx.grid.Grid.__init__(self, parent, -1, size = (400,400))
        self.CreateGrid(100, 20)

app = wx.PySimpleApp()
frame = MainFrame(None)
frame.SetSize((600,400))
frame.Show()
app.SetTopWindow(frame)
app.MainLoop()

#########################

Hi Marcus,
You just hadn't put the grid in a sizer. Correction below.
-Che

import wx
import wx.aui
import wx.grid

class MainFrame(wx.Frame):
   def __init__(self, parent):
       wx.Frame.__init__(self, parent)
       #The AuiManager
       self._mgr = wx.aui.AuiManager( flags=wx.aui.AUI_MGR_DEFAULT )
       self._mgr.SetManagedWindow(self)
       #The window at the center
       PaneInfoCenter =
wx.aui.AuiPaneInfo().Center().MaximizeButton(True).MinSize((200,300))
       notebook = wx.aui.AuiNotebook( self, style =
wx.aui.AUI_NB_WINDOWLIST_BUTTON | wx.aui.AUI_NB_TAB_SPLIT )

       #The first page of the notebook:
       panel = wx.Panel(notebook)
       panelLeft = wx.Panel(panel, -1, size = (200,400))
       text = 'I''d like to see the grid scroll bars and the grid to
be maximized when the window is maximized.'
       wx.TextCtrl(panelLeft, -1, text, size = (200,400),
style=wx.TE_MULTILINE|wx.TE_PROCESS_ENTER)
       panelLeft.SetBackgroundColour(wx.WHITE)
       panelRight = wx.Panel(panel, -1, pos = (200,0), size = (400,400))
       grid = Grid(panelRight)

       #Sizer:
       sizer = wx.BoxSizer(wx.HORIZONTAL)
       sizer.Add(panelLeft, 0)
       sizer.Add(panelRight, 1, wx.EXPAND)
       panel.SetSizerAndFit(sizer)

       #Had to put the grid in a sizer.
       sizer2 = wx.BoxSizer(wx.HORIZONTAL)
       panelRight.SetSizerAndFit(sizer2)
       sizer2.Add(grid, 1, wx.EXPAND)

       notebook.AddPage(panel, caption="Page1")

       #Other pages:
       notebook.AddPage(Grid(notebook), caption="Page2")
       notebook.AddPage(Grid(notebook), caption="Page3")

       self._mgr.AddPane( notebook, PaneInfoCenter )
       #Update the wxAUI manager
       self._mgr.Update()

class Grid(wx.grid.Grid):
   def __init__(self, parent):
       wx.grid.Grid.__init__(self, parent, -1, size = (400,400))
       self.CreateGrid(100, 20)

app = wx.PySimpleApp()
frame = MainFrame(None)
frame.SetSize((600,400))
frame.Show()
app.SetTopWindow(frame)
app.MainLoop()

···

On Sat, Jan 24, 2009 at 7:23 PM, Marcos Duarte <mduartex@gmail.com> wrote:

I am witting an application using the AuiManager and AuiNotebook.
Inside one page of the AuiNotebook I want to have two panels; the
first panel (at the left side with fixed width) will have some widgets
(buttons) and the other panel only a wx.grid.Grid.

The code below illustrates what I want but it doesn't work as I'd like.

I'd like to always see the grid scroll bars and the grid to be
maximized when the window is maximized.

I'd appreciate any help.

I think that last one got mangled...trying again...

import wx
import wx.aui
import wx.grid

class MainFrame(wx.Frame):
   def __init__(self, parent):
       wx.Frame.__init__(self, parent)
       #The AuiManager
       self._mgr = wx.aui.AuiManager( flags=wx.aui.AUI_MGR_DEFAULT )
       self._mgr.SetManagedWindow(self)
       #The window at the center
       PaneInfoCenter =
wx.aui.AuiPaneInfo().Center().MaximizeButton(True).MinSize((200,300))
       notebook = wx.aui.AuiNotebook( self, style =
wx.aui.AUI_NB_WINDOWLIST_BUTTON | wx.aui.AUI_NB_TAB_SPLIT )

       #The first page of the notebook:
       panel = wx.Panel(notebook)
       panelLeft = wx.Panel(panel, -1, size = (200,400))
       text = 'I''d like to see the grid scroll bars and the grid to
be maximized when the window is maximized.'
       wx.TextCtrl(panelLeft, -1, text, size = (200,400),
style=wx.TE_MULTILINE|wx.TE_PROCESS_ENTER)
       panelLeft.SetBackgroundColour(wx.WHITE)
       panelRight = wx.Panel(panel, -1, pos = (200,0), size = (400,400))
       grid = Grid(panelRight)

       #Sizer:
       sizer = wx.BoxSizer(wx.HORIZONTAL)
       sizer.Add(panelLeft, 0)
       sizer.Add(panelRight, 1, wx.EXPAND)
       panel.SetSizerAndFit(sizer)

       #Had to put the grid in a sizer.
       sizer2 = wx.BoxSizer(wx.HORIZONTAL)
       panelRight.SetSizerAndFit(sizer2)
       sizer2.Add(grid, 1, wx.EXPAND)

       notebook.AddPage(panel, caption="Page1")

       #Other pages:
       notebook.AddPage(Grid(notebook), caption="Page2")
       notebook.AddPage(Grid(notebook), caption="Page3")

       self._mgr.AddPane( notebook, PaneInfoCenter )
       #Update the wxAUI manager
       self._mgr.Update()

class Grid(wx.grid.Grid):
   def __init__(self, parent):
       wx.grid.Grid.__init__(self, parent, -1, size = (400,400))
       self.CreateGrid(100, 20)

app = wx.PySimpleApp()
frame = MainFrame(None)
frame.SetSize((600,400))
frame.Show()
app.SetTopWindow(frame)
app.MainLoop()

···

On Sat, Jan 24, 2009 at 9:07 PM, C M <cmpython@gmail.com> wrote:

On Sat, Jan 24, 2009 at 7:23 PM, Marcos Duarte <mduartex@gmail.com> wrote:

I am witting an application using the AuiManager and AuiNotebook.
Inside one page of the AuiNotebook I want to have two panels; the
first panel (at the left side with fixed width) will have some widgets
(buttons) and the other panel only a wx.grid.Grid.

The code below illustrates what I want but it doesn't work as I'd like.

I'd like to always see the grid scroll bars and the grid to be
maximized when the window is maximized.

I'd appreciate any help.