1 import os
2 import os.path
3
4 imageDirectory = None
5
15
17 """Returns the OS-appropriate absolute path for the named image"""
18 import os
19 path = os.path.join(getImageDirectory(),name)
20 return path
21
23 if len(filename) > 0:
24 import Tkinter
25 return Tkinter.PhotoImage(file=filename)
26 else:
27 return None
28
35
37 """Loads a series of images and returns a table
38 @param mapping: a mapping of keys to file names
39 @type mapping: dict
40 @return: a table mapping keys to C{PhotoImage} objects
41 @rtype: dict
42 """
43 result = {}
44 for key,filename in mapping.items():
45 try:
46 result[key] = getPILImage(filename)
47 except:
48 pass
49 return result
50
51 if __name__ == '__main__':
52 print getImage('nobody.gif')
53