OK, I lied, I do have another question...

Anthony Papillion papillion at gmail.com
Mon Jul 11 08:42:30 CEST 2011


Hi Everyone,

So I've used Glade to build a simple UI and I'm loading it with
gtkBuilder. The UI loads fine but, for some reason, none of my signals
are being connected. For example, in Glade, I said when the button
called btnExit was clicked, execute the btnExit_clicked method. Then, in
my App() class definition, I defined btnExit_clicked(self, widget) and
simply added the gtk.main_quit() statement (to exit). But when I start
my app, I am told that the btnExit_clicked() method isn't defined. This
happens for every single signal I define.

I'm assuming I'm simply putting something in the wrong place so can
anyone have a look at this and tell me what that might be? It looks
almost identical to examples I've seen on the net.  Thanks!

CODE:

class App:
    def __init__(self):
        builder = gtk.Builder()
        builder.add_from_file('bcbackup.ui')
        builder.connect_signals({"on_window_destroy" : gtk.main_quit,
"on_btnExit_clicked" : btnExit_clicked})
        self.window = builder.get_object("winMain")
        self.window.show()

    def btnSaveInformation_clicked(self, widget):
        pass

    def btnExit_clicked(self, widget):
        gtk.main_quit()

if __name__ == "__main__":
	myApp = App()
	gtk.main()

END CODE




More information about the Python-list mailing list