Reputation: 114
Whenever I try to return a string from a ComboBox in WxPython, it doesn't return the string correctly, it returns it like this:
<bound method CommandEvent.GetString of <wx._core.CommandEvent; proxy of <Swig Object of type 'wxCommandEvent *' at 0x27e818> >>
And I want it to return string inputted into the Combobox:
self.firmwarelist = wx.ComboBox(panel, pos=(170,22), choices=["6.61","6.61 N1000/Go","6.60","6.60 N1000/Go","6.35","6.35 N1000/Go","6.39","6.39 N1000/Go","6.20","6.10","6.10 N1000/Go","6.60","5.50","5.03","5.00","4.05","4.01","4.00","3.52","3.50","1.50"]
)
self.Bind(wx.EVT_COMBOBOX, self.e, self.firmwarelist)
Here is where the ComboBox returns to
def e(self,e):
global p
i = e.GetString
p = str(i)
print p
return p
Upvotes: 0
Views: 83
Reputation: 2433
It must be
i = e.GetString()
Otherwise it is not a function call.
Edit: And by the way, it is a very bad idea to have the function named the same as a parameter. Try changing one of the e's to something else, for example f.
def e(self, f):
Upvotes: 1