简体   繁体   中英

using cx_freeze to make an executable python program from multiple python scripts

i started to use cx_freeze to make my project to an executable after failing with pyinstaller, i'm using tkinter to make a GUI and the main.py GUI is working and when the 2nd script GUI in suppose to initialize it only initialize the window, but without the menu or any dependencies from tkinter such as slider bars, labels or entry boxes

my setup.py configured this way:

import sys
from cx_Freeze import setup, Executable


includefiles = ['Doctor.xlsx']
includes = []
excludes = []
packages = ['tkinter', 'openpyxl']
build_exe_options = {'includes': includes, 'packages': packages, 'excludes': excludes, 'include_files': includefiles}

base = None
if sys.platform == 'win64':
    base = 'Win64GUI'
elif sys.platform == 'win32':
    base = 'Win32GUI'

exe = Executable(
    script="Main.py",
    target_name="AutoDoctor",
    base = base
)
setup(
    name="AutoDoctor",
    version="1.0",
    description="Program to diagnose blood results and generate a matching treatment.",
    options={'build_exe': build_exe_options},
    executables=[exe],
)

In the project i have multiple scripts: Main.py, Diagnosis.py, Database.py from my understanding the Database.py working well because the Main.py script is using the Database from the Database.py script.

if you are on windows, you can do this from desktop. but if you want to be sure. go to your directory and do this: 在此处输入图像描述

open the cmd and put this code in. make sure that you have installed what you need

Turns out that it was my code that had the problem in my code i destroyed the main window and only then initialized the second function window so it just was an order of function problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM