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

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Larz60p
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 received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

Andrea Gavana
Hi,

On 11 January 2018 at 00:17, Larz60p <[hidden email]> 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.


--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

Larz60p
In reply to this post by Larz60p


On Wednesday, January 10, 2018 at 7:45:46 PM UTC-5, Larz60p 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: <a href="https://wxpython.org/Phoenix/docs/html/wx.lib.pdfviewer.html#module-wx.lib.pdfviewer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwxpython.org%2FPhoenix%2Fdocs%2Fhtml%2Fwx.lib.pdfviewer.html%23module-wx.lib.pdfviewer\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHlBWAu_joFt6T67LPwCkqREmQSkw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwxpython.org%2FPhoenix%2Fdocs%2Fhtml%2Fwx.lib.pdfviewer.html%23module-wx.lib.pdfviewer\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHlBWAu_joFt6T67LPwCkqREmQSkw&#39;;return true;">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 received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

Larz60p
In reply to this post by Andrea Gavana
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 <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="icRyVqGnCwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">l2mat...@...> 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: <a href="https://wxpython.org/Phoenix/docs/html/wx.lib.pdfviewer.html#module-wx.lib.pdfviewer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwxpython.org%2FPhoenix%2Fdocs%2Fhtml%2Fwx.lib.pdfviewer.html%23module-wx.lib.pdfviewer\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHlBWAu_joFt6T67LPwCkqREmQSkw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwxpython.org%2FPhoenix%2Fdocs%2Fhtml%2Fwx.lib.pdfviewer.html%23module-wx.lib.pdfviewer\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHlBWAu_joFt6T67LPwCkqREmQSkw&#39;;return true;">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.


--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.