Report this

What is the reason for this report?

Images permanently inserted into python code

Posted on January 16, 2023

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')

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.