wxpython 中的点击事件错误 [英] Error with on click event in wxpython
本文介绍了wxpython 中的点击事件错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在测试框中收集用户的输入.因此,当我单击一个按钮时,它应该在测试框中为我提供该按钮的名称错误:您应该省略列的任一行
I want to collect input from the user in test box. So when I click a button it should give me name of that button in test box Error: you should omit either rows of column
for i in A:
hbox1=wx.BoxSizer(wx.HORIZONTAL)
btn = wx.Button(p, -1, i, (10,20))
btn.myname = I
gs.Add(btn,0,)
self.Bind(wx.EVT_BUTTON, self.OnClick, btn)
self.t1=wx.TextCtrl(p)
gs.Add(btn,0,)
self.t1.Bind(wx.EVT_BUTTON, self.OnClick, btn)
gs.Add(hbox1)
p.SetSizer(gs)
def OnClick(self, event): #When the button is clicked
name = event.GetEventObject().myname
推荐答案
使用 wx.TextCtrl: self.t1=wx.TextCtrl(p)
Use wx.TextCtrl: self.t1=wx.TextCtrl(p)
这篇关于wxpython 中的点击事件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文