Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to make a programme, which would allow a user to choose, which application to run. I understand, it is possible to just run a command, which user specifies, but it would be much nicer, if it was possible to also give the user a list of all programmes, of which he or she could choose. Is it possible somehow?

share|improve this question
If you downvote the question, please, tell, what is wrong, so I could improve it. – Phlya May 19 '13 at 16:49
up vote 2 down vote accepted

The default GtkAppChooser is probably what you want. Here is an example:

from gi.repository import Gtk

dialog = Gtk.AppChooserDialog()
dialog.set_heading("Choose an application below")
widget = dialog.get_widget()
response =
if response == Gtk.ResponseType.OK:
    appinfo = dialog.get_app_info()
    print "Selected:", appinfo.get_name()
    appinfo.launch(None, None)

Have a look at this documentation page which will show the GtkAppChooserWidget, GtkAppChooseButton and GtkAppChooseDialog to implement inside your application, and the GtkAppChooser interface to work with the options.

GAppInfo.launch() documentation.

share|improve this answer
Thanks a lot, that looks, like what I need! It is a pity, I can't find a documentation for PyGObject, but I hope your example will be sufficient for me. Also, would you happen to know, how to run the application, I get from that dialog, using python? Or is there a way to get a command, which you can just run, to launch the chosen application? – Phlya May 19 '13 at 18:16
Just use the C docs. They are very good and translation to Python is very straightforward. GtkAppChooser.get_app_info() returns a GAppInfo which has a launch() method. ( – Timo May 19 '13 at 18:54
Ok, thank you very much! I hope, that will do it. – Phlya May 19 '13 at 19:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.