在由cx_Freeze构建的exe中," asksaveasfile"和" askopenfile"不工作。

时间:2017-07-29 08:49:42

标签: python-3.x cx-freeze

我有两个专门用于浏览和保存输出的内置按钮。它在控制台中工作正常。但是当我用它构建exe时,这两个按钮根本就不会打开资源管理器以便浏览或保存。 这是cx_freeze代码

import cx_Freeze
import sys

base = None

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

executables = [cx_Freeze.Executable("cypher.py", base=base,icon="icon2.ico")]

cx_Freeze.setup(
name = "Classical-Cypher",
options = {"build_exe": {"packages":["tkinter","PIL"], "include_files":["icon2.ico"]}},
version = "BETA",
description = "Encryption and decryption of classical cyphers",
executables = executables
)

建筑显示没有错误! GUI的图像是GUI

请帮忙。

1 个答案:

答案 0 :(得分:0)

是的,我解决了这个问题! 我在原始脚本中使用了以下内容

import tkinter import tkinter.filedialog

在cx_Freeze脚本中,

options = {"build_exe": {"packages":["tkinter","PIL","tkinter.filedialog"], "include_files":["icon2.ico"]}},

完成! :)