I have created 3 Buttons in a panel they all have same onclick event,
now I have to find which button has called onclick event and it’s ID
Werner gave you the correct answer to the question, but I suggest using
the ID may not be the best way to solve your problem. Alternatively, you
can pass an argument on though the callback, so you know what button is
clicked:
http://wiki.wxpython.org/Passing%20Arguments%20to%20Callbacks
I find this approach more elegant than messing around with IDs
k=len(lst)
#print k
j=400
for i in range(k):
j=j+20
self.Bind(wx.EVT_BUTTON,self.OnButton2Button,id=j) # k buttons
invoking same function
you've got other issues here as well -- you really want to let wx assign
IDs for you, otherwise you could get ID clashes.
and, side note -- it you want every 20 numbers, you can use something like:
range(400,800,20)
HTH,
-Chris
···
On Thu, Oct 10, 2013 at 12:44 AM, werner <wbruhin@free.fr> wrote:
On 10/10/2013 08:30, Divya Patel wrote:
--
Christopher Barker, PhD
Python Language Consulting
- Teaching
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython