I have a frame that is managed by wx.lib.agw.aui.AuiManager. The frame contains a pane that can be minimized and no AuiToolBar. When the pane is minimized it ends up in an automatically created AuiToolBar. If I click on the icon of the AuiToolBar the pane is restored and the AuiToolBar destroyed (or at least hide from view). However, when I use:
tPane = self._mgr.GetPaneByName('CorrAConf')
if tPane.IsMinimized():
self._mgr.RestorePane(tPane)
the pane is restored but the AuiToolBar is not destroyed and the icon for the minimized pane remains visible but does not work anymore. And if I minimized the pane again I get an error saying that the minimized version of the pane already exists.
Is there any way to automatically destroy the AuiToolBar when I restore the pane programmatically, as it happens when I click the icon for the minimized pane?
I tried to directly access the AuiToolBar, to check if there is only one item and then destroy it but I cannot manage to get the actual instance of the AuiToolBar. I tried:
for k in self._mgr.GetAllPanes():
if k.IsToolbar():
tToolBar = self._mgr.GetPane(k)
But I do not know how to get the AuiToolBar associated with this pane. How can I get the AuiToolBar associated with the tToolBar pane?