I'm trying to create a custom dialog using pythoncard.
My main program looks like this (I'm only testing!):
import wx
from PythonCard import dialog, model
import MyDialog
class MyApp(model.Background):
def on_initialize(self, event):
self.MyDialog()
The simple Pythoncard dialog looks like this:
from PythonCard import model
class MyDialog(model.CustomDialog):
def __init__(self, parent, txt=''):
model.CustomDialog.__init__(self, parent)
# if some special setup is necessary, do it here
# example from samples/dialogs/minimalDialog.py
# self.components.field1.text = txt
#def myDialog(parent, txt):
def myDialog(parent):
dlg = MyDialog(parent, txt)
result = dlg.showModal()
# stick your results into the result dictionary here
# example from samples/dialogs/minimalDialog.py
# result.text = dlg.components.field1.text
dlg.destroy()
return result
With this resource file:
{'type':'CustomDialog',
'name':'Template',
'title':'Dialog Template',
'position':(66, 66),
'size':(300, 100),
'components': [
{'type':'Button',
'id':5100,
'name':'btnOK',
'position':(10, 35),
'default':1,
'label':u'OK',
},
{'type':'Button',
'id':5101,
'name':'btnCancel',
'position':(100, 35),
'label':u'Cancel',
},
] # end components
} # end CustomDialog
I just don't seem to be able to get past: MyApp object has no attribute 'MyDialog'
I clearly still have not grasped how classes work! Please help.