I am relatively new to wxPython and having a problem transferring an integer from the main window to a child dialog.
The situation: developing contact (phone-book) app for my own use.
I use a wxListCtrl to list the contacts (persons only) which is connected to an event handler. When a contact is selected (listCtrl is configured to single selection).
The event handler activates an “Edit” button. This Edit button when pressed gets the primary key of the selected contact and calls a dialog (I named it personInput) and transfers the primary key to this dialog to permit getting and loading the data into this dialog box. The code is:
def onEdit(self, event):
''' 1. get the selected person or company
2. open either the personInput or the companyInput dialog
'''
if self.lbPersons.GetSelection()>0:
selItem = self.lbPersons.GetString(self.lbPersons.GetSelection())
for Pers in self.personKeys:
if selItem == Pers[1]:
vKey =(Pers[0])
inputPersDlg = PI.personInput(self)
inputPersDlg.getAction(vKey)
inputPersDlg. ShowModal()
inputPersDlg.Destroy()
The dialog has the function self.getAction:
self.result=self.getAction(*args)
print(self.result)
def getAction(self, event):
return event
My problem is the integer is not transferred but a wx.Window object is transferred. the print displays:
<main.mainWindow object at 0x7fbeb5f3b130>
It is clear that my transfer code is incorrect but I have not yet found a correction.
Hope someone can help me.