Maximizing Panes within wx.aui.AuiManager

Hi everybody,

close to the end of my huge wxpython project I try to implement some improvements. One of them is that the user can DClick on a tab of a wx.aui.AuiNotebook, which is managed by a wx.aui.AuiManager, and the pane representing the notebook should maximize. I know that the easiest way would be

wx.aui.AuiPaneInfo().MaximizeButton(True).CaptionVisible(True)

but IMHO a pane with a notebook as content looks really ugly with a captionbar.

The code below illustrates my present implementation and the problem I have. I bound a mouse DClick event to the TabContainer of my notebook (thanks to the ML for the hints on this issue) and the called function calls the auimanagers MaximizePane()/RestorePane() function with the notebook's pane as argument.

My problem: after double clicking the tab of the notebook, it does maximize 'something' that looks like an empty panel but not the notebook as expected:(. I've also tried to refresh/update the content of the notebook and the frame itself but there is no effect.

I'm lookig forward to any suggestions that would fix the problem.

Greetings,
Tim

Code:

import wx, wx.aui

class MyFrame(wx.Frame):
    def __init__(self, prnt):
        wx.Frame.__init__(self, prnt, wx.ID_ANY, "Aui Tests")

        self.mgr = wx.aui.AuiManager()
        self.mgr.SetManagedWindow(self)

        self.myNB = wx.aui.AuiNotebook(self, wx.ID_ANY)
        self.myNB.AddPage(wx.TextCtrl(self, wx.ID_ANY, style = wx.TE_MULTILINE), "TextCtrl1")
        self.myNB.AddPage(wx.TextCtrl(self, wx.ID_ANY, style = wx.TE_MULTILINE), "TextCtrl2")

        self.Pane1 = wx.aui.AuiPaneInfo().CenterPane().Name("Notebook")
        self.Pane2 = wx.aui.AuiPaneInfo().Bottom().Name("TextCtrl3")
        self.Pane3 = wx.aui.AuiPaneInfo().Bottom().Name("TextCtrl4")
        
        self.mgr.AddPane(self.myNB, self.Pane1)
        self.mgr.AddPane(wx.TextCtrl(self, wx.ID_ANY, style = wx.TE_MULTILINE), self.Pane2)
        self.mgr.AddPane(wx.TextCtrl(self, wx.ID_ANY, style = wx.TE_MULTILINE), self.Pane3)
        
        for widget in self.myNB.GetChildren():
            if isinstance(widget, wx.aui.AuiTabCtrl):
                widget.Bind(wx.EVT_LEFT_DCLICK, self.OnMaximize)

        self.mgr.Update()

    def OnMaximize(self, evt):
        if self.Pane2.IsMaximized():
            self.mgr.RestorePane(self.Pane2)
            self.mgr.Update()
        else:
            self.mgr.MaximizePane(self.Pane2)
            self.mgr.Update()

class BoaApp(wx.App):
    def OnInit(self):
        wx.InitAllImageHandlers()
        self.main = MyFrame(None)
        self.main.Show()
        self.SetTopWindow(self.main)
        return True

if __name__ == '__main__':
    application = BoaApp(0)
    application.MainLoop()

Hello,

Hi everybody,

close to the end of my huge wxpython project I try to implement some improvements. One of them is that the user can DClick on a tab of a wx.aui.AuiNotebook, which is managed by a wx.aui.AuiManager, and the pane representing the notebook should maximize. I know that the easiest way would be

wx.aui.AuiPaneInfo().MaximizeButton(True).CaptionVisible(True)

but IMHO a pane with a notebook as content looks really ugly with a captionbar.

The code below illustrates my present implementation and the problem I have. I bound a mouse DClick event to the TabContainer of my notebook (thanks to the ML for the hints on this issue) and the called function calls the auimanagers MaximizePane()/RestorePane() function with the notebook’s pane as argument.

My problem: after double clicking the tab of the notebook, it does maximize ‘something’ that looks like an empty panel but not the notebook as expected:(. I’ve also tried to refresh/update the content of the notebook and the frame itself but there is no effect.

I’m lookig forward to any suggestions that would fix the problem.

try this,

def OnMaximize(self, evt):
info = self.mgr.GetPane(“Notebook”)
if info.IsMaximized():
self.mgr.RestorePane(info)
else:
self.mgr.RestoreMaximizedPane()

       self.mgr.MaximizePane(info)
   self.mgr.Update()

You had Panel2 as the arg which was not your notebook panel.

Cody

···

On Wed, Jan 28, 2009 at 9:29 AM, Tim Kraemer kraemertim@ymail.com wrote:

Thanks a lot Cody. That works fine!

Greetz
Tim

···

Von: Cody Precord codyprecord@gmail.com
An: wxpython-users@lists.wxwidgets.org
Gesendet: Mittwoch, den 28. Januar 2009, 16:40:59 Uhr
Betreff: Re: [wxpython-users] Maximizing Panes within wx.aui.AuiManager

Hello,

On Wed, Jan 28, 2009 at 9:29 AM, Tim Kraemer kraemertim@ymail.com wrote:

Hi everybody,

close to the end of my huge wxpython project I try to implement some improvements. One of them is that the user can DClick on a tab of a wx.aui.AuiNotebook, which is managed by a wx.aui.AuiManager, and the pane representing the notebook should maximize. I know that the easiest way would be

wx.aui.AuiPaneInfo().MaximizeButton(True).CaptionVisible(True)

but IMHO a pane with a notebook as content looks really ugly with a captionbar.

The code below illustrates my present implementation and the problem I have. I bound a mouse DClick event to the TabContainer of my notebook (thanks to the ML for the hints on this issue) and the called function calls the auimanagers MaximizePane()/RestorePane() function with the notebook’s pane as argument.

My problem: after double clicking the tab of the notebook, it does maximize ‘something’ that looks like an empty panel but not the notebook as expected:(. I’ve also tried to refresh/update the content of the notebook and the frame itself but there is no effect.

I’m lookig forward to any suggestions that would fix the problem.

try this,

def OnMaximize(self, evt):
info = self.mgr.GetPane(“Notebook”)
if info.IsMaximized():
self.mgr.RestorePane(info)
else:
self.mgr.RestoreMaximizedPane()

       self.mgr.MaximizePane(info)
   self.mgr.Update()

You had Panel2 as the arg which was not your notebook panel.

Cody