Basically I am stuck getting back to the auiFrame instance I am calling
the new class from ...
Basis: AUI demo from wx.Python demo
What I want:
For commodity I want my notebook tab content to be a separate class -
#I call a function to have the user give me a name for the new
calculation (1st tab of notebook) and then call my function to get
# the notebook instance from the mgr
# then I call the new class TabPanelCustomer which resides outside the
AuiFrame class
def OnNewCalculation(self, event):
dlg = wx.TextEntryDialog(
self, u'Name for calculation', u'Ndew calc', 'Python')
dlg.SetValue("calculation-")
if dlg.ShowModal() == wx.ID_OK:
calculationname = dlg.GetValue()
self.OnNewCustomerDataTab(-1,calculationname,thebutton)
dlg.Destroy()
#the 1st tab
def OnNewCustomerDataTab(self, event, calculationname,thebutton):
auibook = self._mgr.GetPane("notebook_content").window
newtab = TabPanelCustomer(auibook,calculationname,thebutton,self)
auibook.AddPage(newtab, u'Kundendaten', select=True)
#the 2nd tab
def OnNewProjectSettingsTab(self, event, calculationname):
auibook = self._mgr.GetPane("notebook_content").window
newtab = TabPanelSettings(auibook,calculationname)
auibook.AddPage(newtab, u'Projektdaten', select=True)
# the new class
class TabPanelCustomer(wx.Panel):
def __init__(self, parent, bordername, thebutton, auiframe):
wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)
self.bordername = bordername
self.thebutton = thebutton
self.auiframe = auiframe
self.SetBackgroundColour('White')
# .....
# ..... sizers, etc ......
# here the problem:
save_btn = wx.Button(self, -1, u'Save')
clear_btn = wx.Button(self, -1, u'Clear')
save_btn.Bind(wx.EVT_BUTTON,
AuiFrame.OnNewProjectSettingsTab(auiframe, -1, bordername))
My problem is that I cannot bind the save button to the funtion
OnNewProjectSettingsTab()
I get an assertion error. (see below)
General thinking/ design problem? Solutions/ Approaches?
ThanX
···
--
AssertionError:
File "gui2-standaloneV5.py", line 3893, in <module>
app.MainLoop()
File "C:\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 8010, in MainLoop
wx.PyApp.MainLoop(self)
File "C:\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 7306, in MainLoop
return _core_.PyApp_MainLoop(*args, **kwargs)
File "C:\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\auibar.py", line 3641, in OnLeftUp
self.ProcessEvent(e)
File "C:\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 3863, in ProcessEvent
return _core_.EvtHandler_ProcessEvent(*args, **kwargs)
File "gui2-standaloneV5.py", line 3235, in OnNewCalculation
self.OnNewCustomerDataTab(-1,calculationname,thebutton)
File "gui2-standaloneV5.py", line 3243, in OnNewCustomerDataTab
newtab = TabPanelCustomer(auibook,calculationname,thebutton,self)
File "gui2-standaloneV5.py", line 414, in __init__
save_btn.Bind(wx.EVT_BUTTON, AuiFrame.OnNewProjectSettingsTab(auiframe, -1, bordername))
File "C:\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 3917, in Bind
assert callable(handler)