【发布时间】:2013-03-10 05:56:35
【问题描述】:
self.btid = 0
self.btarray = []
self.btarray.append("x")#so that the buttons are appended according to their ids
self.bmt = wx.BitmapButton(panel, btid, pic, pos=(50,50))
self.btarray.append(self.bmt)
self.btid += 1
我使用相同的代码创建多个按钮。以后如何检索单个按钮的 ID?
提前致谢, 斯威亚姆
【问题讨论】:
-
您没有为按钮设置任何 ID。你不是在定义 btid 而是 self.btid
-
我在迭代创建多个按钮,每次迭代后btid的值都加1
-
不,
btid不会在您的代码中递增。self.btid是。 -
joaquin,这是我的错误,它的 self.bitd