Including binary files in a .py file; advice needed

Chad Netzer cnetzer at mail.arc.nasa.gov
Wed Jun 4 23:03:46 EDT 2003


On Wed, 2003-06-04 at 19:53, Gary Duncan wrote:
> Here's what I want to do; distribute a .py file (a GUI app) with
> an embedded (binary) .GIF file (a photo of me at 1 yo ;) rather than
> distribute both separately. For convenience, mainly.

Which GUI?  For making a button image, using say Tkinter, this should be
fairly straightforward.  May require PIL to make it easy.  You should be
able to convert the uuencoded data directly to binary, using a StringIO
object.

But trying to create icon images is a real pain, seemingly requiring you
to make a temp file with filename, which you give to
Tkinter.icon_bitmap().

I haven't tried it in other GUI toolkits.

-- 

Chad Netzer
(any opinion expressed is my own and not NASA's or my employer's)






More information about the Python-list mailing list