I am trying to create an executable of a code with libraries like Tkinter, Pandas and Pillow.
I used the pyinstllaer
, cx_freeze
and scipy
but I get an error or the .exe has a size not according to what you want (ex: 500 mb).
What I want to get is an executable to be able to open it in Windows and / or MAC to be used by most users.
The code can be something irrelevant for this question, so I need or maybe we need all are understandable tips or tutorials to be able to create an executable, since in the revised questions only specific cases are being solved and not common cases like what I am describing . Thank you.
Here I show the code
import tkinter as tk
from tkinter import ttk
#from sismorresistente import *
from tkinter import messagebox
from PIL import Image
import pandas as pd
import os
class sismicidad():
def __init__(self):
self.vent_sismi = tk.Tk()
self.vent_sismi.iconbitmap("sismo_ico_1.ico")
self.vent_sismi.title("SISMICIDAD")
self.pest_sismor = ttk.Notebook(self.vent_sismi)
self.pest_sismor.grid(row=0, column = 0)
self.sismorresistente_1()
self.perf_suelos()
self.zona_sismi()
self.sismor_funcion()
self.z_sismi_funcion()
self.vent_sismi.mainloop()
#Funciones para la estructura de la pestaña SONAS SISMORRESISTENTE:
def sismorresistente_1(self):
...
#Funcion de CERRAR:
def cerrar_sismicidad(self):
self.vent_sismi.destroy()
#Funciones para la estructura de la pestaña de PERFILES DE SUELOS:
def perf_suelos(self):
...
#Mostrar Tabla de Vs:
def abrir_vs(self):
self.im = Image.open("C:/Users/Miguel Mogollòn/Desktop/sismicidad/tabla_perf.jpg")
self.im.show()
#Funciones para PERFILES DE SUELOS:
def sismor_funcion(self,event=None):
self.x1=self.entry_1.get()
try:
self.x1=int(self.x1)
except ValueError:
messagebox.showwarning("Error", "Escribir solo números enteros.")
while True:
if self.x1 > 1500:
self.eti_lab_11.configure(text="Perfil tipo S0: Roca Dura.", font = "helvetica 12", foreground= "blue")
self.eti_lab_11.grid(row=3, column=0, padx=20, pady=10)
elif self.x1 > 500 and self.x1 <= 1500:
self.eti_lab_11.configure(text="Perfil tipo S1: Roca y Suelos muy rigidos.", font = "helvetica 12", foreground= "blue")
self.eti_lab_11.grid(row=3, column=0, padx=20, pady=10)
elif self.x1 > 180 and self.x1 <= 500:
self.eti_lab_11.configure(text="Perfil tipo S2: Suelos Intermedios.", font = "helvetica 12", foreground= "blue")
self.eti_lab_11.grid(row=3, column=0, padx=20, pady=10)
elif self.x1 > 0 and self.x1 <= 180:
self.eti_lab_11.configure(text="Perfil tipo S3: Suelos Blandos.", font = "helvetica 12", foreground= "blue")
self.eti_lab_11.grid(row=3, column=0, padx=20, pady=10)
elif self.x1 == 0:
self.eti_lab_11.configure(text="")
self.eti_lab_11.grid(row=3, column=0, padx=20, pady=10)
break
#Funciones para la estrutura de la pestaña ZONAS SISMICAS:
def zona_sismi(self, event=None):
...
def abrir_norma(self):
os.popen("C:/Users/Miguel Mogollòn/Desktop/sismicidad/norma_tecnica_e_030.pdf")
def z_sismi_funcion(self, event=None):
self.datos = pd.read_csv("C:/Users/Miguel Mogollòn/Desktop/sismicidad/distri_sism_1.csv", encoding="latin9", sep=";")
self.df = pd.DataFrame(self.datos)
self.x2 = self.entry_2.get()
try:
self.x2=str(self.x2)
except ValueError:
messagebox.showwarning("Error", "Escribir el distrito.")
#while True:
self.x2 = str.upper(self.x2)
for self.idx in self.df.index:
if self.df.DISTRITO[self.idx] == self.x2:
self.eti_lab_14.configure(text = f"La zona sismica de '{self.x2}' es: {self.df.ZONA_SISMICA[self.idx]}", font="helvetica 12", foreground = "blue")
#self.eti_lab_14.grid(row=1, column=1, padx=10, pady=10)
self.eti_lab_14.place(x=30, y=70)
break
else:
self.eti_lab_14.configure(text=f"Ingrese el distrito correcto",font="helvetica 12", foreground="blue")
self.eti_lab_14.place(x=30, y=70)
#self.eti_lab_14.grid(row=1, column=1, padx=10, pady=10)
aplicacion = sismicidad()
Here I show what comes out when I want to open the executable
enter image description here