[Glade-users] (re) creating dialog boxes

Deepankar Sharma deepankar.sharma at gmail.com
Wed Apr 18 21:25:17 EDT 2007


I am having trouble using dialog boxes created using glade 3. The following
code, creates dialogs when the button is clicked, but the number of dialogs
created keeps doubling.
First time you click the button, one dialog pops up. The second time two
dialogs pop up ... and so on.

import os, gtk
import gtk.glade



class app:

    def __init__(self):
        self.gladefile = "one.glade"
        self.wTree = gtk.glade.XML(self.gladefile)
        self.window = self.wTree.get_widget("window1")
        self.window.maximize()
        self.window.connect("destroy", self.do_quit)
        self.main_dict = {
            'b_clicked' : self.b_clicked
            }
        self.wTree.signal_autoconnect(self.main_dict)

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

    def b_clicked (self, widget):
        print "Hi"
        xml = gtk.glade.XML("one.glade", "fd1")
        win = xml.get_widget("fd1")
        win.set_title("Create new album")
        dic = {
                "ok_clicked" : self.ok_clicked,
                "cancel_clicked" : self.cancel_clicked
            }
        xml.signal_autoconnect(dic)
        win.show()
        self.wTree.signal_autoconnect(self.main_dict)


    def ok_clicked (self, widget):
        widget.get_parent_window().destroy()

    def cancel_clicked (self,widget):
        pass


if __name__ == "__main__":
    abc = app()
    abc.window.show()
    gtk.main()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20070418/2c6be6ca/attachment.html 


More information about the Glade-users mailing list