How to embed a GtkAboutDialog's content in a GtkNotebook widget
I'm writing a Python app that is tab-based, and I don't want it to have any additional pop-up dialogs.
I'd like to use the Gtk.AboutDialog
functionality, but I don't want it to appear as a separate window. Rather, I'd like it to be embedded in one of the tabs of my Gtk.Notebook
(which I've created with Glade).
I could not find any obvious way to do this. Does anyone have any pointers?
You can move content area (GtkVBox
) from GtkDialog
to another GtkContainer
, and then append to GtkNotebook
- using gtk.Widget.reparent() method.
about = Gtk.AboutDialog()
about.set_program_name ("Application")
about.set_copyright ("Author")
box = Gtk.VBox ()
about.vbox.reparent (box)
notebook.append_page (box, Gtk.Label("About"))
about.destroy ()
With interface created in Glade, You must do simple trick for this solution. Create "About" tab in notebook with appended GtkBox
(with id for example "about_box"). Then you can do something like this:
box = builder.get_object ("about_box")
about.vbox.reparent (box)
In some reasons Glade's GtkAboutDialog
content area contains also GtkButtonBox
. If You don't need this buttons simply destroy them:
about.action_area.destroy()
If You want only 'Credits' button, without 'Close' button, do something like this:
close_button = about.get_widget_for_response(Gtk.ResponseType.CANCEL)
close_button.destroy()