Notebook Pane added to wx.lib.agw.aui doesn't resize properly

Hello,

Using `wx.lib.agw.aui and wxpython phoenix with python 3.6.4 on windows 7

`I’m building the framework for a new application where I’d like to have a notebook as one of the panes.
The notebook is created, and draws fine initally, but doesn’t resize with the rest of the form what do I need to do here?
Does it need a separate sizer?
Here’s the code:
#!/usr/bin/python

See for pdf: https://wxpython.org/Phoenix/docs/html/wx.lib.pdfviewer.html#module-wx.lib.pdfviewer

import wx
import wx.aui as aui
import wx.lib.agw.aui as aui

class AuiViewer(wx.Frame):
def init(self, parent, id=-1, title=“Test Viewer”, pos=wx.DefaultPosition,
size=(800, 600), style=wx.DEFAULT_FRAME_STYLE):
wx.Frame.init(self, parent, id, title, pos, size, style)

    self._mgr = aui.AuiManager()

    # notify AUI which frame to use
    self._mgr.SetManagedWindow(self)

    # First pane is Rfc Selection window located top left
    # ----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
    self.selector = wx.ListCtrl(self,
                                id=wx.ID_ANY,
                                pos=wx.DefaultPosition,
                                size=wx.Size(200, 150),
                                style=wx.NO_BORDER | wx.TE_MULTILINE,
                                name='Selector')

    self.selector.InsertColumn(0, 'Doc Id', width=60)
    self.selector.InsertColumn(1, 'Title', width=200)

    self.selector.SetMinSize(wx.Size(500, 300))
    self.selector.SetMaxSize(wx.Size(1000, 800))

    self.selector.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.display_summary)
    self.selector.Bind(wx.EVT_LEFT_DCLICK, self.display_detail)

    self.load_selector()

    # ----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
    self.summary = wx.TextCtrl(self,
                               id=wx.ID_ANY,
                               value="Pane 2 - Summary Text Here",
                               pos=wx.DefaultPosition,
                               size=wx.Size(200, 150),
                               style=wx.NO_BORDER | wx.TE_MULTILINE,
                               name='Summary')

    # Final window is a two tab notebook, one for text files and one for pdf files. One or both
    # may be populated for any given RFC document.
    # ----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
    self.detail = aui.AuiNotebook(self,
                                  id=wx.ID_ANY,
                                  pos=wx.DefaultPosition,
                                  size=wx.DefaultSize,
                                  style=0,
                                  agwStyle=wx.lib.agw.aui.AUI_NB_DEFAULT_STYLE,
                                  name="RfcDocumentNotebook")

    self.Detail_page = wx.TextCtrl(self.detail,
                                   id=-1,
                                   pos=wx.DefaultPosition,
                                   size=wx.Size(200, 150),
                                   style=wx.NO_BORDER | wx.TE_MULTILINE,
                                   name='DetailNotebookTabs')

    self.detail.AddPage(self.Detail_page, "Text Document")
    self.detail.AddPage(self.Detail_page, "PDF Document")

    # add the panes to the manager
    self._mgr.AddPane(self.selector, aui.AuiPaneInfo().Left().Caption("Doc Selection"))
    self._mgr.AddPane(self.summary, aui.AuiPaneInfo().Bottom().Caption("Doc Summary"))
    self._mgr.AddPane(self.detail, aui.AuiPaneInfo().CenterPane().Caption('Doc Detail'))

    # tell the manager to "commit" all the changes just made
    self._mgr.Update()

    self.Bind(wx.EVT_CLOSE, self.OnClose)

def load_selector(self):
    pass

def display_detail(self, event):
    self.detail.Clear()
    Print('display_detail')

def display_summary(self, event):
    self.summary.Clear()
    print('display_summary')

def OnClose(self, event):
    # deinitialize the frame manager
    self._mgr.UnInit()
    event.Skip()

def main():
app = wx.App()
frame = AuiViewer(None)
app.SetTopWindow(frame)
frame.Show()
app.MainLoop()

if name == ‘main’:
main()

``

Hi,

···

On 11 January 2018 at 00:17, Larz60p l2mat9c879@gmail.com wrote:

Hello,

Using `wx.lib.agw.aui and wxpython phoenix with python 3.6.4 on windows 7

`I’m building the framework for a new application where I’d like to have a notebook as one of the panes.
The notebook is created, and draws fine initally, but doesn’t resize with the rest of the form what do I need to do here?
Does it need a separate sizer?
Here’s the code:
#!/usr/bin/python

See for pdf: https://wxpython.org/Phoenix/docs/html/wx.lib.pdfviewer.html#module-wx.lib.pdfviewer

import wx
import wx.aui as aui
import wx.lib.agw.aui as aui

class AuiViewer(wx.Frame):
def init(self, parent, id=-1, title=“Test Viewer”, pos=wx.DefaultPosition,
size=(800, 600), style=wx.DEFAULT_FRAME_STYLE):
wx.Frame.init(self, parent, id, title, pos, size, style)

    self._mgr = aui.AuiManager()

    # notify AUI which frame to use
    self._mgr.SetManagedWindow(self)

    # First pane is Rfc Selection window located top left
    # ----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
    self.selector = wx.ListCtrl(self,
                                id=wx.ID_ANY,
                                pos=wx.DefaultPosition,
                                size=wx.Size(200, 150),
                                style=wx.NO_BORDER | wx.TE_MULTILINE,
                                name='Selector')

    self.selector.InsertColumn(0, 'Doc Id', width=60)
    self.selector.InsertColumn(1, 'Title', width=200)

    self.selector.SetMinSize(wx.Size(500, 300))
    self.selector.SetMaxSize(wx.Size(1000, 800))

    self.selector.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.display_summary)
    self.selector.Bind(wx.EVT_LEFT_DCLICK, self.display_detail)

    self.load_selector()

    # ----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
    self.summary = wx.TextCtrl(self,
                               id=wx.ID_ANY,
                               value="Pane 2 - Summary Text Here",
                               pos=wx.DefaultPosition,
                               size=wx.Size(200, 150),
                               style=wx.NO_BORDER | wx.TE_MULTILINE,
                               name='Summary')

    # Final window is a two tab notebook, one for text files and one for pdf files. One or both
    # may be populated for any given RFC document.
    # ----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
    self.detail = aui.AuiNotebook(self,
                                  id=wx.ID_ANY,
                                  pos=wx.DefaultPosition,
                                  size=wx.DefaultSize,
                                  style=0,
                                  agwStyle=wx.lib.agw.aui.AUI_NB_DEFAULT_STYLE,
                                  name="RfcDocumentNotebook")

    self.Detail_page = wx.TextCtrl(self.detail,
                                   id=-1,
                                   pos=wx.DefaultPosition,
                                   size=wx.Size(200, 150),
                                   style=wx.NO_BORDER | wx.TE_MULTILINE,
                                   name='DetailNotebookTabs')

    self.detail.AddPage(self.Detail_page, "Text Document")
    self.detail.AddPage(self.Detail_page, "PDF Document")

    # add the panes to the manager
    self._mgr.AddPane(self.selector, aui.AuiPaneInfo().Left().Caption("Doc Selection"))
    self._mgr.AddPane(self.summary, aui.AuiPaneInfo().Bottom().Caption("Doc Summary"))
    self._mgr.AddPane(self.detail, aui.AuiPaneInfo().CenterPane().Caption('Doc Detail'))

    # tell the manager to "commit" all the changes just made
    self._mgr.Update()

    self.Bind(wx.EVT_CLOSE, self.OnClose)

def load_selector(self):
    pass

def display_detail(self, event):
    self.detail.Clear()
    Print('display_detail')

def display_summary(self, event):
    self.summary.Clear()
    print('display_summary')

def OnClose(self, event):
    # deinitialize the frame manager
    self._mgr.UnInit()
    event.Skip()

def main():
app = wx.App()
frame = AuiViewer(None)
app.SetTopWindow(frame)
frame.Show()
app.MainLoop()

if name == ‘main’:
main()

``

you are adding the same page twice to the notebook. Can’t do that. Try something like this:

self.Detail_page = wx.TextCtrl(self.detail,

id=-1,

pos=wx.DefaultPosition,

size=wx.Size(200, 150),

style=wx.NO_BORDER | wx.TE_MULTILINE,

name=‘DetailNotebookTabs’)

self.Detail_page2 = wx.TextCtrl(self.detail,

id=-1,

pos=wx.DefaultPosition,

size=wx.Size(200, 150),

style=wx.NO_BORDER | wx.TE_MULTILINE,

name=‘DetailNotebookTabs’)

self.detail.AddPage(self.Detail_page, “Text Document”)

self.detail.AddPage(self.Detail_page2, “PDF Document”)

Andrea.

Hello,

Using `wx.lib.agw.aui and wxpython phoenix with python 3.6.4 on windows 7

`I’m building the framework for a new application where I’d like to have a notebook as one of the panes.
The notebook is created, and draws fine initally, but doesn’t resize with the rest of the form what do I need to do here?
Does it need a separate sizer?
Here’s the code:
#!/usr/bin/python

See for pdf: https://wxpython.org/Phoenix/docs/html/wx.lib.pdfviewer.html#module-wx.lib.pdfviewer

import wx
import wx.aui as aui
import wx.lib.agw.aui as aui

class AuiViewer(wx.Frame):
def init(self, parent, id=-1, title=“Test Viewer”, pos=wx.DefaultPosition,
size=(800, 600), style=wx.DEFAULT_FRAME_STYLE):
wx.Frame.init(self, parent, id, title, pos, size, style)

    self._mgr = aui.AuiManager()

    # notify AUI which frame to use
    self._mgr.SetManagedWindow(self)

    # First pane is Rfc Selection window located top left
    # ----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
    self.selector = wx.ListCtrl(self,
                                id=wx.ID_ANY,
                                pos=wx.DefaultPosition,
                                size=wx.Size(200, 150),
                                style=wx.NO_BORDER | wx.TE_MULTILINE,
                                name='Selector')

    self.selector.InsertColumn(0, 'Doc Id', width=60)
    self.selector.InsertColumn(1, 'Title', width=200)

    self.selector.SetMinSize(wx.Size(500, 300))
    self.selector.SetMaxSize(wx.Size(1000, 800))

    self.selector.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.display_summary)
    self.selector.Bind(wx.EVT_LEFT_DCLICK, self.display_detail)

    self.load_selector()

    # ----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
    self.summary = wx.TextCtrl(self,
                               id=wx.ID_ANY,
                               value="Pane 2 - Summary Text Here",
                               pos=wx.DefaultPosition,
                               size=wx.Size(200, 150),
                               style=wx.NO_BORDER | wx.TE_MULTILINE,
                               name='Summary')

    # Final window is a two tab notebook, one for text files and one for pdf files. One or both
    # may be populated for any given RFC document.
    # ----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
    self.detail = aui.AuiNotebook(self,
                                  id=wx.ID_ANY,
                                  pos=wx.DefaultPosition,
                                  size=wx.DefaultSize,
                                  style=0,
                                  agwStyle=wx.lib.agw.aui.AUI_NB_DEFAULT_STYLE,
                                  name="RfcDocumentNotebook")

    self.Detail_page = wx.TextCtrl(self.detail,
                                   id=-1,
                                   pos=wx.DefaultPosition,
                                   size=wx.Size(200, 150),
                                   style=wx.NO_BORDER | wx.TE_MULTILINE,
                                   name='DetailNotebookTabs')

    self.detail.AddPage(self.Detail_page, "Text Document")
    self.detail.AddPage(self.Detail_page, "PDF Document")

    # add the panes to the manager
    self._mgr.AddPane(self.selector, aui.AuiPaneInfo().Left().Caption("Doc Selection"))
    self._mgr.AddPane(self.summary, aui.AuiPaneInfo().Bottom().Caption("Doc Summary"))
    self._mgr.AddPane(self.detail, aui.AuiPaneInfo().CenterPane().Caption('Doc Detail'))

    # tell the manager to "commit" all the changes just made
    self._mgr.Update()

    self.Bind(wx.EVT_CLOSE, self.OnClose)

def load_selector(self):
    pass

def display_detail(self, event):
    self.detail.Clear()
    Print('display_detail')

def display_summary(self, event):
    self.summary.Clear()
    print('display_summary')

def OnClose(self, event):
    # deinitialize the frame manager
    self._mgr.UnInit()
    event.Skip()

def main():
app = wx.App()
frame = AuiViewer(None)
app.SetTopWindow(frame)
frame.Show()
app.MainLoop()

if name == ‘main’:
main()

``

···

On Wednesday, January 10, 2018 at 7:45:46 PM UTC-5, Larz60p wrote:

That was indeed the problem. Thank you!

···

On Thursday, January 11, 2018 at 2:21:03 AM UTC-5, Infinity77 wrote:

Hi,

On 11 January 2018 at 00:17, Larz60p l2mat...@gmail.com wrote:

Hello,

Using `wx.lib.agw.aui and wxpython phoenix with python 3.6.4 on windows 7

`I’m building the framework for a new application where I’d like to have a notebook as one of the panes.
The notebook is created, and draws fine initally, but doesn’t resize with the rest of the form what do I need to do here?
Does it need a separate sizer?
Here’s the code:
#!/usr/bin/python

See for pdf: https://wxpython.org/Phoenix/docs/html/wx.lib.pdfviewer.html#module-wx.lib.pdfviewer

import wx
import wx.aui as aui
import wx.lib.agw.aui as aui

class AuiViewer(wx.Frame):
def init(self, parent, id=-1, title=“Test Viewer”, pos=wx.DefaultPosition,
size=(800, 600), style=wx.DEFAULT_FRAME_STYLE):
wx.Frame.init(self, parent, id, title, pos, size, style)

    self._mgr = aui.AuiManager()

    # notify AUI which frame to use
    self._mgr.SetManagedWindow(self)

    # First pane is Rfc Selection window located top left
    # ----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
    self.selector = wx.ListCtrl(self,
                                id=wx.ID_ANY,
                                pos=wx.DefaultPosition,
                                size=wx.Size(200, 150),
                                style=wx.NO_BORDER | wx.TE_MULTILINE,
                                name='Selector')

    self.selector.InsertColumn(0, 'Doc Id', width=60)
    self.selector.InsertColumn(1, 'Title', width=200)

    self.selector.SetMinSize(wx.Size(500, 300))
    self.selector.SetMaxSize(wx.Size(1000, 800))

    self.selector.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.display_summary)
    self.selector.Bind(wx.EVT_LEFT_DCLICK, self.display_detail)

    self.load_selector()

    # ----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
    self.summary = wx.TextCtrl(self,
                               id=wx.ID_ANY,
                               value="Pane 2 - Summary Text Here",
                               pos=wx.DefaultPosition,
                               size=wx.Size(200, 150),
                               style=wx.NO_BORDER | wx.TE_MULTILINE,
                               name='Summary')

    # Final window is a two tab notebook, one for text files and one for pdf files. One or both
    # may be populated for any given RFC document.
    # ----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
    self.detail = aui.AuiNotebook(self,
                                  id=wx.ID_ANY,
                                  pos=wx.DefaultPosition,
                                  size=wx.DefaultSize,
                                  style=0,
                                  agwStyle=wx.lib.agw.aui.AUI_NB_DEFAULT_STYLE,
                                  name="RfcDocumentNotebook")

    self.Detail_page = wx.TextCtrl(self.detail,
                                   id=-1,
                                   pos=wx.DefaultPosition,
                                   size=wx.Size(200, 150),
                                   style=wx.NO_BORDER | wx.TE_MULTILINE,
                                   name='DetailNotebookTabs')

    self.detail.AddPage(self.Detail_page, "Text Document")
    self.detail.AddPage(self.Detail_page, "PDF Document")

    # add the panes to the manager
    self._mgr.AddPane(self.selector, aui.AuiPaneInfo().Left().Caption("Doc Selection"))
    self._mgr.AddPane(self.summary, aui.AuiPaneInfo().Bottom().Caption("Doc Summary"))
    self._mgr.AddPane(self.detail, aui.AuiPaneInfo().CenterPane().Caption('Doc Detail'))

    # tell the manager to "commit" all the changes just made
    self._mgr.Update()

    self.Bind(wx.EVT_CLOSE, self.OnClose)

def load_selector(self):
    pass

def display_detail(self, event):
    self.detail.Clear()
    Print('display_detail')

def display_summary(self, event):
    self.summary.Clear()
    print('display_summary')

def OnClose(self, event):
    # deinitialize the frame manager
    self._mgr.UnInit()
    event.Skip()

def main():
app = wx.App()
frame = AuiViewer(None)
app.SetTopWindow(frame)
frame.Show()
app.MainLoop()

if name == ‘main’:
main()

``

you are adding the same page twice to the notebook. Can’t do that. Try something like this:

self.Detail_page = wx.TextCtrl(self.detail,

id=-1,

pos=wx.DefaultPosition,

size=wx.Size(200, 150),

style=wx.NO_BORDER | wx.TE_MULTILINE,

name=‘DetailNotebookTabs’)

self.Detail_page2 = wx.TextCtrl(self.detail,

id=-1,

pos=wx.DefaultPosition,

size=wx.Size(200, 150),

style=wx.NO_BORDER | wx.TE_MULTILINE,

name=‘DetailNotebookTabs’)

self.detail.AddPage(self.Detail_page, “Text Document”)

self.detail.AddPage(self.Detail_page2, “PDF Document”)

Andrea.