python - 使用 cx_freeze 卡住的 pyGTK 应用程序看起来有所不同

标签 python pygtk cx-freeze

使用 cx_freeze 卡住应用程序(我使用 Gui2Exe 创建并运行 cx_freeze 脚本)和使用 python 解释器运行它时,我的应用程序看起来有所不同。

[由于我不允许发布图片,这里是 UI 的链接,编辑吗?]

脚本运行:

Application as run from the command line

卡住运行:

Application as run after being frozen by cx_freeze

我尝试过在 cx_freeze 脚本中包含和不包含 list 文件,但我不确定是什么导致应用程序 UI 发生如此巨大的变化。

这是 cx_freeze 脚本:

# ======================================================== #
# File automagically generated by GUI2Exe version 0.5.3
# Copyright: (c) 2007-2012 Andrea Gavana
# ======================================================== #

# Let's start with some default (for me) imports...

from cx_Freeze import setup, Executable



# Process the includes, excludes and packages first

includes = ['ast', 'gobject', 'gtk']
excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',
            'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
            'Tkconstants', 'Tkinter']
packages = ['BeautifulSoup', 'mechanize', 'pygtk']
path = []

# This is a place where the user custom code may go. You can do almost
# whatever you want, even modify the data_files, includes and friends
# here as long as they have the same variable name that the setup call
# below is expecting.

# No custom code added

# The setup for cx_Freeze is different from py2exe. Here I am going to
# use the Python class Executable from cx_Freeze


GUI2Exe_Target_1 = Executable(
    # what to build
    script = "moodle-downloader.py",
    initScript = None,
    base = 'Win32GUI',
    targetDir = r"md",
    targetName = "moodle-downloader.exe",
    compress = True,
    copyDependentFiles = True,
    appendScriptToExe = True,
    appendScriptToLibrary = True,
    icon = r"C:\Users\Nasser.Al-Hilal\Dropbox\CodeN\Projects\Applications\Personal\MoodleDownloader\res\md.ico"
    )


# That's serious now: we have all (or almost all) the options cx_Freeze
# supports. I put them all even if some of them are usually defaulted
# and not used. Some of them I didn't even know about.

setup(

    version = "0.3",
    description = "An app to assist in downloading assignment submissions from Moodle LMS.",
    author = "Nasser Al-Hilal",
    name = "Moodle Downloader",

    options = {"build_exe": {"includes": includes,
                             "excludes": excludes,
                             "packages": packages,
                             "path": path
                             }
               },

    executables = [GUI2Exe_Target_1]
    )

# This is a place where any post-compile code may go.
# You can add as much code as you want, which can be used, for example,
# to clean up your folders or to do some particular post-compilation
# actions.

# No post-compilation code added


# And we are done. That's a setup script :-D

如果我能让应用程序看起来与从解释器运行时相同,我会更愿意。

最佳答案

要工作,您必须下载 gtkruntime,将其安装在系统上,然后复制 lib 文件夹并共享生成的构建文件夹,然后将 bin 文件夹 gtkruntime 的内容复制到您的构建文件夹,然后开始工作。

关于python - 使用 cx_freeze 卡住的 pyGTK 应用程序看起来有所不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14558464/

相关文章:

python - cx_freeze 和 pyttsx 出现 win32com 错误

python - 使用 cx_Freeze 和 tkinter 时,我得到 : "DLL load failed: The specified module could not be found." (Python 3. 5.3)

python - 在python中获取未读邮件中特定人员的附件

linux - 在 Linux (Linux mint) 中创建您自己的定制应用程序软件中心的最佳方法是什么?

python - 在 PyGTK 中启用或禁用 gtk.Button

python - 使用 cx_Freeze 将所有 DLL 和 PYD 移动到子文件夹

python - Django 单元测试 : CSS selectors to test HTML?

python - 计算大矩阵特征值的最快方法

python - 正则表达式匹配多个重复组

pygtk - 使用 Anaconda 导入 pygtk 时出错