[pygtk] My dialog is empty when opened for second time
goli
g382nilieh at gmail.com
Wed Feb 24 15:10:49 WST 2010
I have a problem with sowing a dialog using glade and pygtk, here is my
code:
class Sample:
def __init__ (self):
self.builder = gtk.Builder()
self.builder.add_from_file("../data/sample.glade")
self.builder.connect_signals(self)
self.window = self.builder.get_object("mywindow")
self.window.set_modal(True)
self.window.show_all()
def addDialog(self, sender):
dialog = self.builder.get_object("dialog1")
label = self.builder.get_object("label2")
print label.get_text()
print dialog.get_title()
result = dialog.run()
if result == 1 :
print "ok!"
else :
print "no, thanks :D"
dialog.destroy()
I have connected addDialog to the clicked event of a button on "mywindow".
The first time I click it, I can see "dialog1" which has "label2"
inside. the next time I click that button, "dialog1" is opened but with
no widgets inside!
but in trminal the "label2" text and "dialog1" title is printed
correctly, means that they are constructed but not visible.
I also connected "dialog1" delete-event to gtk_widget_hide in the glade
file, but no changes happend.
More information about the pygtk
mailing list