exex con cx_Freeze
« il: Luglio 07, 2019, 11:24 »
Slave a tutti ho un piccolo codice con una gui tkinter da trasformare in eseguibile con cx_Freeze:

import tkinter
from tkinter import ttk, StringVar
from tkinter.filedialog import askopenfilename

class GUI:

    def __init__(self, window):
        # 'StringVar()' is used to get the instance of input field
        self.input_text = StringVar()
        self.input_text1 = StringVar()
        self.c = StringVar()
        self.path = ''
        self.path1 = ''
        self.path2 = ''

        window.title("Request Notifier")
        window.resizable(0, 0) # this prevents from resizing the window
        window.geometry("700x300")

        ttk.Button(window, text = "Model File", command = lambda: self.set_path_Model_File_field()).grid(row = 0, ipadx=5, ipady=8) # this is placed in 0 0
        ttk.Entry(window, textvariable = self.input_text, width = 70).grid( row = 0, column = 1, ipadx=1, ipady=1) # this is placed in 0 1

        ttk.Button(window, text = "Forces File", command = lambda: self.set_path_Force_file_field()).grid(row = 1, ipadx=5, ipady=8) # this is placed in 0 0
        ttk.Entry(window, textvariable = self.input_text1, width = 70).grid( row = 1, column = 1, ipadx=1, ipady=1) # this is placed in 0 1
       
       
        ttk.Label(window,  text = "Output File").grid(row = 2, ipadx=5, ipady=15)
        ttk.Entry(window, textvariable = self.c, width = 70).grid( row = 2, column = 1, ipadx=1, ipady=1)

        ttk.Button(window, text = "RUN", command = lambda: [f() for f in [self.set_mio_field(),self.set_exit_field()]]).grid(row = 4, ipadx=5, ipady=15) # this is placed in 0 0
           
    def set_path_Model_File_field(self):
        self.path = askopenfilename()
        self.input_text.set(self.path)

    def set_path_Force_file_field(self):
        self.path1 = askopenfilename()
        self.input_text1.set(self.path1)
       
    def set_mio_field(self):
        self.path2 = self.c.get()
   
    def set_exit_field(self):
        window.destroy()
       

       

if __name__ == '__main__':
    window = tkinter.Tk()
    gui = GUI(window)
    window.mainloop()
    # Extracting the full file path for re-use. Two ways to accomplish this task is below.
    #print(gui.path, '\n', gui.path1)
    in_model  = gui.path
    in_forces = gui.path1
    output_name   = gui.path2

il file setup.py che uso per cx_freeze è:
import cx_Freeze
import sys
import matplotlib
import pandas
base = None

if sys.platform == 'win32':
    base = 'Win32GUI'

executables = [cx_Freeze.Executable('SW_bar_solve.py',base=base)]
cx_Freeze.setup(name='primo',
                options = {'build_exe':{'packages':['tkinter', 'matplotlib', 'pandas']}},
                version='0.01',
                description = 'e il primo',
                executables = executables

                )

Da Propt uso il comado 'python sutup.py build' mi genera un eseguible ma a doppio click non mostra nulla ho provato diverse soluzioni ma nulla.

Qualcuno può aiutarmi  risolvere il problema.
grazie mille.