[pygtk] quit button did not show up

mike mik3l3374 at gmail.com
Sun Jul 2 17:01:15 WST 2006


hi
i just picked up gtk GUI programming. I was following the tutorial on
Buttons.. and did the example code.

class Buttons:
    def callback(self,widget,data=3DNone):
        print "Hello again - %s was press" %data
    def delete_event(self,widget,event,data=3DNone):
        gtk.main_quit()
        return False
    def __init__(self):
        self.window =3D gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.set_title("Image buttons")
        self.window.connect("delete_event",self.delete_event)
        self.window.connect("destroy", self.delete_event)
        self.window.set_border_width(20)

        button =3D gtk.Button()
        button.connect("clicked",self.callback,"cool button")
        box1 =3D xpm_label_box(self.window,"info.xpm","cool button")
        button.add(box1)

        ## add "quit" button
        quitbox =3D gtk.HBox(False,0)
        quitbutton =3D gtk.Button("quit")
        quitbutton.connect("clicked",lambda w: gtk.main_quit())
        quitbox.pack_start(quitbutton,1,1,2)


        self.window.add(button)
        #self.window.add(quitbox)
        box1.show()
        button.show()
        quitbox.show()
        self.window.show()

    def main(self):
        gtk.main()
        return 0

if __name__ =3D=3D "__main__":
    a =3D Buttons()
    a.main()



Its suppose to show a button with an image inside. I wanted to add a "quit"
button after the button with image, but the "quit" button
did  not show up...which part of my code is wrong? thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20060702/a07ab878/at=
tachment.htm


More information about the pygtk mailing list