What you want is a dictionary of the method objects.  The class dictionary
will not do (as that contains unbound methods, where the self parameter
must be explicitely passed.

The instance dictionary also will not do, as it does not contain the
methods either.  You would want to use some code something like:
  dict = {}
  for key in dir(self.__class__):
        dict[key] = getattr(self, key)

This will give the bound methods that you can autoconnect with.

I know it is not perfect, but it should do what you want.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Thu, 10 Feb 2000, Daniel Kornhauser wrote:

> 
> Hi I'm making a gnome-hello example for my pygtutorial 
> http://laguna.fmedic.unam.mx/~daniel/pygtutorial/
> and I'm stuck with the libglade example.
> I'm trying to do a gnome-hello like the one in my tutorial but with glade.
> 
> My problem is the following:
> When I autoconect a handler, the handle is called ONLY with the callback
> argument and the instance reference isn't passed at all.
> 
> PLEASE run the unfinished example I attached to see what I mean.
> Select the menu "help" and clik in "about".
> 
> The example just instances a GnomeApp with a buton and menus.
> My problem comes when I want to show a GnomeAbout I made with glade.
> I try to do this selecting "about" in the "help" menu.
> Even if I am in the SAME class the "on_about_cb" method can't reference
> the  self.wtree which I need to show the GnomeAbout widget.
> This is because the "on_about_cb" method only recieves the
> argument callback but not the instance reference.
> --------------- partial code ------------------------------------------
> class Application:
>     def __init__(self):
>       self.hello = Hello()                     
>         self.wtree = libglade.GladeXML('gnome-hello.glade')
>         print "I instance self.wtree",self.wtree
>         self.wtree.get_widget('app').connect("destroy", mainquit) 
>         print "***Here is the dictionary ot the instance were I can see\
>         self.wtree"
>         print(self.__dict__)
>         print "Here is the dictionary of the class were I can see\
>         on_about_cb"
>         print(Application.__dict__)
>         self.wtree.signal_autoconnect(Application.__dict__)
> 
>     def on_about_cb(self,*args):
>         print "This should contain the instance directory like in\
>         ***",self
>         print "This should contain the widget",args
>         #self.wtree.get_widget('about_cb').show()
> ----------------------------------------------------------------------
> 
> The following code prints when I activate the "about..." menu:
> 
> ----------------------------------------------------------------------
> I instance self.wtree <libglade.GladeXML instance at 81cfb40>
> 
> ***Here is the dictionary ot the instance were I can see self.wtree
> {'wtree': <libglade.GladeXML instance at 81cfb40>, 'hello':
> <__main__.Hello instance at 8209a50>}
> 
> Here is the dictionary of the class were I can see on_about_cb
> {'__init__': <function __init__ at 81f20e0>, '__doc__': None,
> 'on_about_cb': <function on_about_cb at 8209a88>, '__module__':
> '__main__'}
> 
> This should contain the instance directory like in *** <gtk.GtkBin
> instance at 8263f98>
> 
> This should contain the pixmap ()
> -----------------------------------------------------------------------
> 
> What I'm I doing wrong?
> 
> Note:
> I'm not following the SkelImpl.py example because I don't understand his
> Object Oriented paradigm. Methods should be with the class they belong to,
> not all together in one "GladeHandlers" class.
> 
> Thanks
> 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]

Reply via email to