[pygtk] TypeError: enter() takes no arguments (1 given)

Peter E Dennis peter.edwin.dennis at gmail.com
Sun Mar 8 17:55:18 WST 2009


Hi All,

This is my first time posting to the list so apologies if attachments
aren't possible.  I have attached the glade file and have the
following program as I try to learn PyGTK:
#!/usr/bin/env python

import sys
try:
    import pygtk
    pygtk.require('2.0')
except:
    pass
try:
    import gtk
    import gtk.glade
except:
    sys.exit(1)


class MainWindow:

    def __init__(self):

        # Set the Glade file
        self.gladefile = "sscce.glade"
        self.wTree = gtk.glade.XML(self.gladefile)

        # Get the Main Window, and connect the "destory" event
        self.window = self.wTree.get_widget("window1")
        if (self.window):
            self.window.connect("destroy", gtk.main_quit)

        # Get the status bar and display info to user when entered
        self.statusbar1 = self.wTree.get_widget("statusbar1")

        self.button1 = self.wTree.get_widget("button1")
        if (self.button1):
            self.button1.connect("enter", self.button1.enter)
            self.statusbar1.push(1, "Button entered")

    def main(self):
        gtk.main()


if __name__ == "__main__":
    mw = MainWindow();
    gtk.main()

At the moment I'm trying to learn how to use the gtk.Button.enter method.

However when I launch my script/app and each time I move the mouse
pointer over the button, I get the error as shown in the subject and
below:
$ ./main.py
TypeError: enter() takes no arguments (1 given)
TypeError: enter() takes no arguments (1 given)
TypeError: enter() takes no arguments (1 given)

I don't really understand this error as it appears (to me) that I'm
actually giving 0 arguments to the method 'self.button1.enter'

Could someone please explain (I feel like Pauline Hanson) why the
error mentions one argument given and what I can do to fix it?

Also if anyone has the time it would be great to see how I can then
display a message in the status bar, at the moment the message appears
when I first launch the app, so no idea if it is actually working
during the mouse over or not.

Many thanks,

Peter.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sscce.glade
Type: application/x-glade
Size: 7636 bytes
Desc: not available
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20090308/24f42a8c/attachment.bin 


More information about the pygtk mailing list