Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I'm writing an Python app that makes use of a Gtk.AboutDialog. Some of the information shown in the dialog comes from setting properties for bits of info I've just given elsewhere, and I'd like to avoid duplication.

For instance, in the code:

about = Gtk.AboutDialog()

The program name and the version are already specified in setup.py (I'm using python-distutils-extra as the build system).

So is there a way to extract that information at runtime (be it from setup.py or somewhere else), so that I don't have to manually specify it again?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

You can place a constants.py for example, in the python package for your program, and define the values there, instead of in setup.py. You can then import that module from setup.py or the code which shows the about dialog, and set the appropriate values from the appropriate constants.

share|improve this answer

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.