Hi Murat,
Excuse me but I was too synthetic 
I will try to explain it better:
Sometimes I have to modify or debug a program made by me (or by someone else) and I would like, for instance, to change the behavior of pressing a particular button.
In a small program it is very easy to do it: I only have to read a hand-full of code lines.
But in large programs with several script files, with several classes an several dialogs, that task is not so easy!
Particularly if I am not the author or if my memory not helps me as it should 
Suppose that at near the end of main script, I put something like this:
#--------------------------------------------------
class MyApp(wx.App):
def OnInit(self):
(...)
self.Bind(wx.EVT_RIGHT_UP , self.OnRightClick) #only for debug!
def OnRightClick(self, event):
import inspect
obj = wx.FindWindowAtPointer()
name=obj.GetName()+' '+obj.GetLabel()
A=[name]
parent=obj.GetParent()
bases= parent.__class__.__bases__[0]
methodList = [ method for method in dir (parent) if method not in dir (bases) and callable(getattr(parent, method)) ]
for method in methodList:
A.append('Method: '+method)
method=myPopUp(self.dialog_1,A) #myPopup gives a popup menu, and returns the choice
myattr=method.split()
if len(myattr)>1:
s=getattr(parent,myattr[1])
script=inspect.getsourcefile(s)
line=inspect.getsourcelines(s)[1]
print 'TRACE ---->[%s] %s Script: "%s" line %d' %(name,method,script, line)
else:
print 'TRACE ----> [%s]' %(name)
#--------------------------------------------------
With this, I get the name of object that I am inspecting, and a list of methods of parent's class.
What I would like is to show only the relevant methods: - the ones that are BOUND to it!
It is possible?
I know that I can parse the class code and search for lines that have «.bind», but it is not a good solution, don't you agree?
I hope to have been more clear.
Thanks for your attention.
Antonio Barbosa
-----Mensagem original-----
De: Murat Erten [mailto:murerten@gmail.com]
Enviada: seg 26-02-2007 19:01
Para: wxPython-users@lists.wxwidgets.org
Assunto: Re: [wxPython-users] Bound Methods
2007/2/26, António Barbosa (GN/dpi) <ab@jn.pt>:
>
> Hi,
>
> I am playing with «introspection» and I would like to know if it is possible
> to know which method is bound to a particular object.
>
> Or putting the problem in another form: It's possible to know which object
> is bound to a particular method?
>
> Suppose a window with 2 buttons (bt1 + bt2)
>
> And:
>
> bt1.Bind(wx.EVT_BUTTON, self.onButton1)
>
> bt2.Bind(wx.EVT_BUTTON, self.onButton2)
>
> I can easily identify the two objects, the two methods of their parent and
> the source line where they are defined.
>
> But:
>
> How can I know that onButton1 is bound to bt1 and onButton2 is bound to bt2?
>
> Or:
>
> How can I know that bt1 is bound to onButton1 and bt2 is bound to
> onButton2?
>
> Any help would be appreciated.
>
> Antonio Barbosa
>
I think you already know that by saying:
bt1.Bind(wx.EVT_BUTTON, self.onButton1)
bt2.Bind(wx.EVT_BUTTON, self.onButton2)
What are you trying to do ? What is your purpose ? Can you be more specific ?
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org