【发布时间】:2018-08-13 08:16:51
【问题描述】:
我使用 cx_freeze 制作了一个可执行的 gui(带有 tkinter)文件。可执行文件有几个按钮。当用户点击按钮时,计算应该会工作,然后它会写出一个 xlsx 文件。
当我制作可执行文件时一切都很顺利,没有错误。但是当我单击按钮时,计算似乎有效(因为它正在加载),但它并没有写出 xlsx 文件。
我不知道出了什么问题。谁能帮帮我?
这里是 setup.py 文件:
import sys
from cx_Freeze import setup, Executable
import os
import tkinter
base = None
if sys.platform == 'win32':
base = "Win32GUI"
executables = [Executable("gui.py", base=base)]
packages = ["tkinter", 'xlsxwriter', 'matplotlib']
options = {
'build_exe': {
'includes': ["os", "tkinter", 'numpy.core._methods', 'numpy.lib.format', 'xlrd', 'scipy', 'pandas'],
'include_files': [r"C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\DLLs\tcl86t.dll",
r"C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\DLLs\tk86t.dll"]
},
}
os.environ['TCL_LIBRARY'] = r'C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\tcl\tk8.6'
setup(
name="Tool",
version="1.0",
description="Tool prototype for calculating",
options=options,
executables=executables
)
【问题讨论】:
标签: user-interface executable cx-freeze xlsxwriter