close button in pygtk about dialog not closing dialog
I'm drawing an interface for a pygtk application using glade, and I've made an about dialog. I'm having trouble with the close button in the about dialog. The close button in the credits operates as expected, but in the about dialog the button does nothing, so it has to be closed with the windows manager. I went to select the button by clicking on it and by expanding the items contained in t开发者_如何学编程he GtkHButtonBox, but I can't expand it in the top right section, and if I click on it it just selects the GtkHButtonBox. I've looked it up and found GtkAboutDialog Close Button Bug and About Dialog I tried following those instructions, but thought they seemed a bit funny since it puts destroy immediately after show, and that's exactly what it's doing, it just destroys it straight away after showing it. I also looked in the pygtk tutorial but that hasn't been updated since 2005, so doesn't have anything about the about dialog.
filename = "sudoku_gui.glade"
builder = gtk.Builder()
builder.add_from_file(filename)
builder.connect_signals(self)
aboutWindow = builder.get_object('about_Sudoku')
aboutWindow.show()
Please help me with it, I'll be much appreciated.
Solution: Because the solution doesn't directly provide the detail needed, I'll put it in here for reference. The last line should be changed to
aboutWindow.run()
not show(), then add
aboutWindow.destroy()
which will close the dialog when the close button is clicked.
Try this page : http://zetcode.com/tutorials/pygtktutorial/dialogs/
Hope this helps.
精彩评论