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 am writing a project with Quickly and GTK 3 and I want to use the get_media_file() helper so I can load an icon in my data/media directory.

I can't see how I use get_media_file() with the latest quickly; it looks like the Quickly helpers have changed.

Can anyone provide me with some sample code of how this works?

share|improve this question

Tell me if by 'latest' you don't mean the one that ships with 11.10, but this is how to use the function here:

>>> from hello_lib.helpers import get_media_file
>>> get_media_file("hello.svg")

"hello.svg" can be any fragment of a path (like ../media/hello.svg or stuff/hello.svg). I.e. get_media_file(f) is the equivalent of

"file://" + os.path.join(get_data_path(), "media", f)

And get_data_path() will return /home/stefano/hello/data.

These functions are defined in hello/hello_lib/ and hello/hello_lib/

share|improve this answer

It seems you just give it the name of the file in your data/media directory.

For example, if you want data/media/foo.png, you just call get_media_file('foo.png'). This will return a file:/// URI of the absolute path to foo.png.

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.