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

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


> 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'

Not entirely sure what I was trying to achieve here:
self.button1.connect("enter", self.button1.enter)

I think I was connecting the signal "enter" to the method enter()
which makes no real sense.

> 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.

To get a message to appear in the status bar I instead did the following:

        .......
        self.button1 = self.wTree.get_widget("button1")
        if (self.button1):
            #self.button1.connect("enter", self.button1.enter)
            self.button1.connect("enter", self.statusMessage)

    def statusMessage(self, widget):
        self.statusbar1.push(1, "Button Entered")

Then when I moved the mouse over the button - voila - message in status bar.

>
> Many thanks,
>
> Peter.
>

You're welcome. :P


More information about the pygtk mailing list