]>
Commit | Line | Data |
---|---|---|
1 | ||
2 | import sys, os, glob | |
3 | from wxPython.tools import img2py | |
4 | ||
5 | output = 'images.py' | |
6 | ||
7 | # get the list of PNG files | |
8 | files = glob.glob('src-images/*.png') | |
9 | ||
10 | # Truncate the inages module | |
11 | open(output, 'w') | |
12 | ||
13 | # call img2py on each file | |
14 | for file in files: | |
15 | ||
16 | # extract the basename to be used as the image name | |
17 | name = os.path.splitext(os.path.basename(file))[0] | |
18 | ||
19 | # encode it | |
20 | if file == files[0]: | |
21 | cmd = "-u -i -n %s %s %s" % (name, file, output) | |
22 | else: | |
23 | cmd = "-a -u -i -n %s %s %s" % (name, file, output) | |
24 | img2py.main(cmd.split()) | |
25 | ||
26 | ||
27 |