[pygtk] TypeError: enter() takes no arguments (1 given)
Peter E Dennis
peter.edwin.dennis at gmail.com
Sun Mar 8 18:22:55 WST 2009
Hi All,
This is my first time posting (actually second - I foolishly attached
the glade file to first post and got rejected).
I have the following program:
#!/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 "destroy" 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.
More information about the pygtk
mailing list