Hi All'
How can I embed images (.png, .gif, etc) into a single py file and call them in program
I saw them in wxpy demo but how exactly to embedd them??

Appreciation,
Steve

Recommended Answers

All 5 Replies

I meant storing images in .py file. I don't know if it is synonomous with embedding!

how do you conert them to that form?
I mean from something.png to "zyYsabskalUYDTbsnsmjahaHSGYDKD" representing that image

I find it puzzling

This was how vega did it:

import base64
jpgfile = "halloween3.jpg"
jpg_text = base64.encodestring(open(jpgfile,"rb").read())
print jpg_text

Hope that helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.