By Likith
I have python code that generates excel from other files, and I want to permanently incorporate photos into that code. To enable anyone to open my programme and generate an excel, I want to create an.exe file. There should be two photos in the header of this file (excel). How do I get the software or application to load the right files from the user’s computer? Because of the username and the location of the file’s storage, the path to the file may change. I’m going to presume that both of the picture files and the.exe executable file are in the same folder.
Below is the code of how it works now:
logo = Image("C:/Users/STJ2TW/Desktop/folder/logo.png")
element = Image("C:/Users/STJ2TW/Desktop/folder/element.png")
ws.merge_cells('A1:E3')
logo.width = 500
logo.height = 120
element.width = 140
element.height = 140
element.alignment = Alignment(horizontal="left", vertical="center")
ws.add_image(logo, 'A1')
ws.add_image(element, 'E1')
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi @likith,
I’m not sure there is a way to know the exact path every time. What you can try though are two things in my eyes.
path = "C:/Users/STJ2TW/Desktop/folder"
logo = Image(f"{path}/logo.png")
element = Image(f"{path}/element.png")
The above would mean you need to configure only the path in the program. Since all people will have a different setup, you can just set instructions on how to configure it.
An alternative would be to set instructions for where the images need to be, in which directory.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.