Q
Q
QPython2019-01-13 13:55:00
Python
QPython, 2019-01-13 13:55:00

When compiling a program into an exe file, how can I make the pictures used from my laptop available for opening on other computers?

Wrote a program in Python. I used pictures in it that are stored on my laptop. Now I'm trying to create an exe file of the program. I would be grateful for a hint on how to make pictures available for opening on other computers in an exe file?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
CHolfield, 2019-01-13
@CHolfield

Convert image files to base64 strings, there are plenty of online services. Your source is binary, the output is a base64 string. And assign these lines to variables inside the python script. In the text of the program, perform the reverse conversion to an array of bytes and then to a picture. The stage with strings and conversion can be skipped if you store an array of bytes in variables.
UPD: there must be some regular way to add resources to the file through the development environment, but this is inaccurate)

V
Vladimir Proskurin, 2019-01-13
@Vlad_IT

You need to look at what kind of packer you have in exe, it probably has a built-in tool for packing resources into exe. For example, for py2exe www.py2exe.org/index.cgi/data_files for cx_Freeze there is an include_files parameter.
Just google
НАЗВАНИЕ_ПАКОВЩИКА pack images

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question