views:

40

answers:

1

I'm having trouble toggling panes with the AUIManager.

Here's basically what I'm doing:

class foo(wx.Frame):
    def __init__(self, parent, title):
        wx.Frame.__init__(self,parent,wx.ID_ANY,title,size=wx.Size(800,600))
        self.menubar = wx.MenuBar()

        self._mgr = wx.aui.AuiManager(self)
        self._mgr.AddPane(self.randomwidget, wx.LEFT, 'Widget Name')
        self._mgr.Update()

        self.menu_view = wx.Menu()
        self.menu_view_randomwidget = wx.MenuItem(self.menu_view,wx.ID_ANY, 'Widget Name', kind=wx.ITEM_CHECK)
        self.menu_view.AppendItem(self.menu_view_randomwidget)
        self.Bind(wx.EVT_MENU, self.togglePane, id=self.menu_view_randomwidget.GetId())
        self.menubar.Append(self.menu_view, '&View')

    def togglePane(self,event):
        if self._mgr.GetPane('Widget Name').IsShown():
            self._mgr.GetPane('Widget Name').Hide()
        else:
            self._mgr.GetPane('Widget Name).Show()
        print self._mgr.GetPane('Widget Name').IsOk()

This always results in a 'False' output. Is there a more appropriate way to toggle various aui panes?