-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

Being a Newbie, I was surprised to see that I could not do something like that for my 
brand new
gnome2 applet (see >>> enphasis):

class MyApplet:
~    def __init__(self,applet):
~        propxml="""
        <popup name="button3">
            <menuitem name="Item 1" verb="Props" label="_Preferences..." 
pixtype="stock"
pixname="gtk-properties"/>
        </popup>
        """

~        self.cfg = { }
~        self.get_config()
|>>     applet.setup_menu(propxml,[ ("Props",MyApplet.properties) ],self)
~        applet.add(frame)
~        applet.show_all()
|>> def properties(widget,self):
~        # Access self.cfg here, display a property box
~        pass
~    def get_config(self):
~        pass # Do something, get config from gconf

def applet_factory(applet):
~    MyApplet(applet)

No, in fact, when I successfully got it to work, the arguments passed to the callback 
properties()
were a BonoboUIComponent instance and the verb being called ("Props"). I assumed the 
3rd arg to
setup_menu() would be passed to the callback as 'data'.

I use gnome-python & pyGtk 2.0.0.

My questions:
1) What is the 3rd argument of setup_menu() (gnome-python says it is extra_args) and 
how is it used?
2) Can callbacks be methods of a class?
2b) How to pass 'self' to a callback?
3) Should I just use procedural functions?

Thanks for a great software!!

- --
==============
Martin Gadbois
S/W Developper
Colubris Networks Inc.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE/eIgh9Y3/iTTCEDkRAmaMAKCoh1K7bPdyXYYg1Tu6E2Hid67DQACgh9BU
l68PzXqistIGC4r7YqFxc/0=
=321/
-----END PGP SIGNATURE-----

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to