I am writing an app that uses the wx.AUI frame manger, based on the
sample included in wxPython (AUI_Docking_Window_Mgr). When a menu
item is pressed, I want the grid (centre pane in the code below) to
clear, but I don't know how to refer to it when using AUI.
class MenuEventFrame(wx.aui.AuiMDIParentFrame):
def __init__(self, parent, id=-1, title="IDEA",
pos=wx.DefaultPosition,
size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE |
wx.SUNKEN_BORDER |
wx.CLIP_CHILDREN):
wx.Frame.__init__(self, parent, id, title, pos, size, style)
self._mgr = wx.aui.AuiManager()
self._mgr.SetManagedWindow(self)
.........
self._mgr.AddPane(self.CreateGrid(), wx.aui.AuiPaneInfo().Name
("grid_content").
CenterPane())
self._mgr.Update()
........#create menus
def OnLoad(self, event):
# I want to call clear(), but don't know how to refer to the
frame/center pane??
return
Anypointers gratefully received, it's driving me nuts.
Try self._mgr.GetPane('grid_content').window though I don't know if it
is the desired way to get the associated window of the pane.
Of course you can also directly assign an instance variable to store
the grid when you create your frame:
...
self.grid = self.CreateGrid()
self._mgr.AddPane(self.grid, ....)
Then you can always refer to the grid object in class methods with
self.grid:
def OnLoad(self, event):
self.grid.clear()
···
On Jul 13, 8:49 pm, Big_Killers <jamie.kilpatrick...@btinternet.com> wrote:
I am writing an app that uses the wx.AUI frame manger, based on the
sample included in wxPython (AUI_Docking_Window_Mgr). When a menu
item is pressed, I want the grid (centre pane in the code below) to
clear, but I don't know how to refer to it when using AUI.
class MenuEventFrame(wx.aui.AuiMDIParentFrame):
def \_\_init\_\_\(self, parent, id=\-1, title="IDEA",
pos=wx.DefaultPosition,
size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE |
wx.SUNKEN_BORDER |
wx.CLIP_CHILDREN):
wx\.Frame\.\_\_init\_\_\(self, parent, id, title, pos, size, style\)
self\.\_mgr = wx\.aui\.AuiManager\(\)
self\.\_mgr\.SetManagedWindow\(self\)
\.\.\.\.\.\.\.\.\.
self\.\_mgr\.AddPane\(self\.CreateGrid\(\), wx\.aui\.AuiPaneInfo\(\)\.Name
("grid_content").
CenterPane())
self._mgr.Update()
........#create menus
def OnLoad(self, event):
# I want to call clear(), but don't know how to refer to the
frame/center pane??
return
Anypointers gratefully received, it's driving me nuts.