wxpython 隐藏_使用cxFreeze冻结wxPython应用程序时如何隐藏控制台窗口?

该博客探讨了在Python中使用cx_Freeze库创建GUI应用程序时遇到的问题。当添加--console参数运行程序以在控制台模式下工作时,程序无法正常运行。示例代码来源于cx_Freeze的PyQt4样本,展示了如何在Windows上创建一个没有关联控制台的执行文件。解决方案旨在解决GUI应用程序与控制台模式之间的切换问题。
摘要由CSDN通过智能技术生成

小编典典

这在某种程度上有效,但是存在问题。我的程序在控制台模式和GUI模式下运行。当使用--console参数从控制台运行时,它将在控制台模式下运行。当我按照下面的过程进行操作时,此操作不再起作用,那时我的程序只是一个GUI应用程序。

以下源代码来自中的示例文件\Python\Lib\site-

packages\cx_Freeze\samples\PyQt4\setup.py。一天的课。阅读自述文件。

# A simple setup script to create an executable using PyQt4. This also

# demonstrates the method for creating a Windows executable that does not have

# an associated console.

#

# PyQt4app.py is a very simple type of PyQt4 application

#

# Run the build process by running the command 'python setup.py build'

#

# If everything works well you should find a subdirectory in the build

# subdirectory that contains the files needed to run the application

import sys

from cx_Freeze import setup, Executable

base = None

if sys.platform == "win32":

base = "Win32GUI"

setup(

name = "simple_PyQt4",

version = "0.1",

description = "Sample cx_Freeze PyQt4 script",

executables = [Executable("PyQt4app.py", base = base)])

2020-12-20

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值