I'm new to pygtk and I'm trying to figure out why I can't connect a
signal to a class method from within the class?

I'm trying to execute the following code:


from gtk import *

class SomeClass:
        def init_widgets(self):
                w = GtkWindow()
                w.connect("delete_event", mainquit)
                b = GtkButton(label=" Foo ")
                b.connect("clicked", self.do_something)
                w.add(b)
                b.show()
                w.show()
        def do_something(self):
                print "wowie-zowie"
        def __init__(self):
                self.init_widgets()
                mainloop()

if __name__=="__main__":
        x = SomeClass()


but Python spits this at me when I push the button:
TypeError: too many arguments; expected 1, got 2

It all works if I move the code from a class to "plain" Python.
I'm using Python 1.5.2, pygtk 0.6.3, gtk+-1.2.5 on a Debian 2.1.
Is this normal behavior? I believe not. Does anybody know how I can
work around this? Or did I miss something?

TIA,
        Dirk

-- 
Dirk H�sken
:wq

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

Reply via email to