每当我尝试从WxPython中的ComboBox返回一个字符串时,它都没有正确返回字符串,它会像这样返回:
<bound method CommandEvent.GetString of <wx._core.CommandEvent; proxy of <Swig Object of type 'wxCommandEvent *' at 0x27e818> >>
我希望它返回输入到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)
这是ComboBox返回的地方
def e(self,e):
global p
i = e.GetString
p = str(i)
print p
return p
答案 0 :(得分:1)
一定是
i = e.GetString()
否则它不是函数调用。
编辑:顺便说一句,让一个名为参数的函数是一个非常糟糕的主意。尝试将其中一个更改为其他内容,例如f。
def e(self, f):