views:

37

answers:

2

I use GtkAboutDialog and everything works fine except the close button of this widget. All other buttons works fine, I don't know how but all buttons have default callbacks and they create and destroy the windows. But the "Close" button of GtkAboutDialog widget does not work. I can not even see it's widget. So, can I access it?

[CLARIFICATION] What you're looking at is gtk.AboutDialog — popup window displaying information about an application (new in PyGTK 2.6). This window contains the 'close' button widget which is contained in a GtkHButtonBox widget. The GtkHButtonBox widget is the highest level widget I am able to access for some. Any ideas on how to get to the "close" button and connect a handler for a callback signal?

alt text

+1  A: 

You don't conenct signals in the same way for a dialog as you do for a window. I made the same mistake when learning PyGTK.

The most basic form of a dialog is you display and run the dialog with:

aboutdialog.run()

Often you will then immediately call:

aboutdialog.destroy()

The .run() line is a loop, which runs until something happens within the dialog.

There is a working example here.

Andrew Steele
+1  A: 

The gtk.AboutDialog is just a gtk.Dialog, and you handle responses from it in the same way. Instead of connecting to the clicked signal of the buttons, the dialog code handles that for you and returns a reponse from your run() call. You can check the value of the response returned to figure out what button was clicked.

If you're trying to override some behaviour instead, you can connect to the response signal of gtk.Dialog.

Kai