You just need to comment the " self._mgr.Update()" line - it will work
now.
If you want more sophisticated behavior of changing the frame size to
fit the collapsed panel you may check here :
http://www.markandclick.com/1/post/2011/12/wxpython-show-and-hide-toolbar-adjust-size-and-layout.html
···
On Dec 14, 6:49 am, luvspython <srehtva...@gmail.com> wrote:
I have a panel that includes a PyCollapsiblePane. It was working fine
in a regular frame and notebook.I converted to using an AUI-managed frame and an AUI notebook, and
when the PyCollapsible pane is toggled, the frame collapses (shrinks?)
to essentially nothing. Below is a small example. Am I doing
something wrong? If not, is there some way to work around this?Thank you ... Bob (code follows)
import wx
import wx.lib.agw.aui as aui
import wx.lib.agw.pycollapsiblepane as PCPclass CollapsiblePanePanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, wx.ID_ANY)
szrSelf = wx.BoxSizer(wx.VERTICAL)
self.SetSizer(szrSelf)cpAlarm = PCP\.PyCollapsiblePane\(self, label='COLLAPSABILE
PANE', style=wx.CP_DEFAULT_STYLE|wx.CP_NO_TLW_RESIZE)
paneAlarm = cpAlarm.GetPane()
button = wx.Button(paneAlarm, -1, 'Alarm button')szrSelf\.Add\(cpAlarm, 0, wx\.EXPAND|wx\.TOP|wx\.LEFT|wx\.RIGHT,5\)
class Demo(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, wx.ID_ANY, "AGW AUI Notebook
problem", size=(600,400))self\.\_mgr = aui\.AuiManager\(\) self\.\_mgr\.SetManagedWindow\(self\) \# create a notebook with 2 tabs notebook = aui\.AuiNotebook\(self\) panelOne = wx\.Panel\(notebook, \-1\) resPanel = CollapsiblePanePanel\(notebook\) notebook\.AddPage\(panelOne, "PanelOne", False\) notebook\.AddPage\(resPanel, "Problem Panel", False\) self\.\_mgr\.AddPane\(notebook,
aui.AuiPaneInfo().Name("notebook_content").CenterPane().PaneBorder(False))
self._mgr.Update()#----------------------------------------------------------------------
# Run the program
if __name__ == "__main__":
app = wx.PySimpleApp()
frame = Demo()
frame.Show()
app.MainLoop()