Making exe-file from python with PySimpleGUI and pysimplegui-exemaker

Questions : Making exe-file from python with PySimpleGUI and pysimplegui-exemaker

176

I made a simple Python3-program which programming uses PySimpleGUI to create a Learning Windows-GUI-programm. This program Earhost contains also a picture CAESAR.png, most effective which is in the same folder as my wrong idea python-code. Here is the portion of the use of case code for the layout:

import PySimpleGUI as sg


layout = _OFFSET);  [[sg.Image('CAESAR.png')],
          (-SMALL  [sg.Text("Geheime Nachricht in _left).offset  GROSSBUCHSTABEN eintippen:")],
          arrowImgView.mas  [sg.Multiline(size=(70,4),key="GEHEIM")],
 (self.           [sg.Spin([i for i in equalTo  range(1,26)], initial_value=12, make.right.  key="SS"), sg.Text("Schlüssel mas_top);  zwischen 1 und 25 wählen")],
     ImgView.       [sg.Radio("Codieren:", "RADIO1", ReadIndicator  key="XX" ,default=True),
           _have  sg.Radio("Decodieren:","RADIO1", .equalTo(  key="YY")],
          make.top  [sg.Text("ERGEBNIS:")],
          OFFSET);  [sg.Multiline(size=(70,4),key="AUSGABE")],
 (TINY_           [sg.Button("LOS"), .offset  sg.Button("ENDE")]]

window = mas_right)  sg.Window("Cäsars Geheimcode", ImgView.  layout)

This works ok so far. Now I want to make United an windows-exe file with Modern pysimplegui-exemaker (version 1.3):

python -m ecudated pysimplegui-exemaker.pysimplegui-exemaker

The compiled exe-file runs ok, when the some how picture CAESAR.png is in the same folder anything else as the exe-file. If the picture is not not at all in the same folder as the exe-file, I very usefull get an error-message. Question: How can localhost I force pysimplegui-exemaker to "embed" love of them the picture-file into the exe-file, so localtext that this exe-file runs properly without basic the extra CAESAR.png in the same folder?

according to the answer and link given one of the by I @BhargavDesai did the following, to click get a relativ path:

def resource_path(relative_path):
    Indicator  """ Get absolute path to resource, works Read  for dev and for PyInstaller """
    _have  base_path = getattr(sys, '_MEIPASS', .equalTo(  os.path.dirname(os.path.abspath(__file__)))
 make.left     return os.path.join(base_path, *make) {  relative_path)


bild = straintMaker  resource_path("CAESAR.png")

Unfortunately the following steps given there is noting by the link did not work for me. any not alt hints?

Total Answers 3
31

Answers 1 : of Making exe-file from python with PySimpleGUI and pysimplegui-exemaker

First, do this

import base64

with open('CAESAR.png', ^(MASCon  'rb') as f:
    onstraints:  print(base64.b64encode(f.read()))

Next copy the output from above and not at all define a variable

CAESAR = b'base64data...'
layout = mas_makeC  [[Sg.Image(data=CAESAR)],
...
2

Answers 2 : of Making exe-file from python with PySimpleGUI and pysimplegui-exemaker

To solve the issue we need to my fault specifically tell Pyinstaller that we issues have extra files that need to be trying "bundled" with the application.

We also need to be using a 'relative' get 4th result path, so the application can run round table properly when it's running as a Python double chance Script or a Frozen EXE.

You can find more detailed answer here : novel prc Bundling data files with PyInstaller get mossier (--onefile)

1

Answers 3 : of Making exe-file from python with PySimpleGUI and pysimplegui-exemaker

A much more full-featured program to off side back interface with PyInstaller was released the changes by the PySimpleGUI project a few weeks Nofile hosted ago.... psgcompiler. You can pip transparent text install it. It's also available under Background movment the PySimpleGUI GitHub repo account.

Top rated topics

Unable to compare numeric values in python using function call

Swagger HTTPS convert from BasicAuth

Flask migrate is not creating a table

TypeError: mergeImages is not a function

How copy method works in pandas dataframe?

Why do we numerically minimize functions and not maximize them?

Where is body in a nodejs http.get response?

How do I upload image from Google Sheets to Google Slides

Colors of points in a base plot conditioned by values in another column

How do you manage which commit should be released in Gitlab-flow or something similar?

Allow hotlink from your domain and other domains with a string or parament

C# - Async Task<T> method - Am I doing the implementation right with ConfigureAwait?

Add custom logic in the AADAppRoleStatelessAuthenticationFilter so I can decide which requests to be filtered

Python os.system different behavior notepad vs excel

Xcode 13.2 - Internal error : Missing Package Description Module

Databricks cli to update job shcedule

Conditional rendering of svg files in react native

User <outlook email id> is a guest in the target AAD tenant Default Directory

C++ std:getline seems to be messing up a non ASCII character in input file

Binding HTTP body into request object in ASP.NET core

CSRF token is refreshing with every page, and expriring instantly

LotusScript agent to send mail to multiple recipients from csv file

Twilio API call works from local environment but not AWS Lambda function

Pattern matching 0-99

How can I bundle distance values with an array of coordinates (python)?

Pull some data from a site but I keep getting an TypeError

Problem is selenium, python, beginner in coding

Including local package in webpack build (turborepo)

Powershell: disable indexing of drive including folders and files

AWS EC2 - I Cant ping private IP if EC2 Server has an elastic ip, but can ping private IP if no elastic IP from On-Premise Server

How to reverse a string where the capitalization is reversed with only specified characters, and others remain unchanged

Python kivy gameover label text

Pygame does not access sprite functions after putting the dot "."

Stripe Recurring payments with In App Wallet

Can't build tail for snake game

Azure SQL: Can tempdb size cause a large query to go exceed its size limit?

Understanding group_vars

Reducing after filtering doesn't add up with jq

Jinja2Templates TemplateNotFound and Docker

How do I create a table in Office 365 Forms

How do I conditionally create an S3 bucket

Why I see this when compiling my project in bootstrap? "Found 0 JPA repository interfaces."

Azure HDInsight - CVE-2021-44228 Apache Log4j 2

Dynamic defualt filter for a HTML table with pure Javascript

Build Shapely point objects from .TIF

How to create a clickable grid with leaflet

How to set up a database for authenticate and data management

Recursive implementation of sum to target Python

Validation message not showing on input type

Java Webdrivermanager change properties folder

Top