The AppChooserDialog provides a dialog container which allows selecting or opening of applications. The dialog lists applications which are associated with the specified file type.


The AppChooserDialog can be constructed using the following:

appchooserdialog = Gtk.AppChooserDialog(flags, content_type)

The flags parameter should be set to Gtk.DialogFlags.MODAL or Gtk.DialogFlags.DESTROY_WITH_PARENT. The content_type value should be set to the mimetype of the file which is to be opened.

A title should be placed on the AppChooserDialog indicating the function:


To ensure correct positioning of the dialog on the parent window, use:


..note :

The AppChooserDialog utilises the AppChooser backend for common methods and functions.


When the AppChooserDialog has been created use:


The commonly used signals of a AppChooserDialog are:

"response" (dialog, response_id)
"close" (dialog)

The "close" event occurs when the user presses the Escape button on the keyboard, or the Gtk.ResponseType.CLOSE response is met. Alternatively, "response" can be emitted when anything happens within the AppChooserDialog. Both events emit the AppChooserDialog object with the function, however the "response" signal also emits a response_id value of the event that occurred within the AppChooserDialog.


Below is an example of a AppChooserDialog:

#!/usr/bin/env python3

from gi.repository import Gtk

class AppChooserDialog(Gtk.AppChooserDialog):
    def __init__(self):
        Gtk.AppChooserDialog.__init__(self, content_type="image/png")
        self.connect("response", self.on_response)

    def on_response(self, dialog, response):
        if response == Gtk.ResponseType.OK:
            app_info = appchooserdialog.get_app_info()
            name = app_info.get_display_name()
            description = app_info.get_description()

            print("Name:\t\t%s" % (name))
            print("Description:\t%s" % (description))

appchooserdialog = AppChooserDialog()

Download: AppChooserDialog