【发布时间】:2014-10-10 10:41:32
【问题描述】:
我有一个问题。 我有一个程序 // 脚本,它运行良好,但是当我使用 cx_Freeze 编译它时,它不起作用:名称“filedialog”未定义。 我必须以其他方式导入它吗? 我的脚本部分:
from tkinter import *
from shutil import *
import sys
import os
#Vars:
location = os.path.dirname(sys.argv[0])+"/"
if os.path.isfile(location+"filedic.txt"):
file = open(location+"filedic.txt","r").read()
else:
fiRoot = Tk()
fiRoot.withdraw()
file = str(filedialog.askdirectory())
还有我的设置脚本:
import sys
from cx_Freeze import setup, Executable
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup(
name = "BlackChat",
version = "1.3",
description = "BlackChat was programmed by David Jandrey",
executables = [Executable("BlackChat.py", base = base,icon = "BlackChat.ico")])
感谢您的回答。
【问题讨论】:
-
尝试专门做
from tkinter import filedialog。看起来 cx_Freeze 由于某种原因无法复制它。 -
谢谢,但我已经试过了。好吧,让我们再试一次。
-
OMG 现在可以工作了吗?!非常感谢
标签: python cx-freeze filedialog