简体   繁体   English

如何在Sublime Text 2中运行wxPython GUI应用程序

[英]How to run a wxPython GUI app in Sublime Text 2

I just started to use Sublime Text 2. 我刚开始使用Sublime Text 2。

I use Sublime for python, but when I use CTRL + B it does not run my wxPython GUI app. 我使用Sublime for python,但是当我使用CTRL + B时它不会运行我的wxPython GUI应用程序。 It can run a Tkinter app. 可以运行Tkinter应用程序。

Why is this? 为什么是这样? What do I need to do to run a wxPython app from Sublime? 从Sublime运行wxPython应用程序需要做什么?

To prevent the console window from popping up under Windows, it is suppressed in the Packages\\Default\\exec.py module. 为了防止控制台窗口在Windows下弹出,它在Packages\\Default\\exec.py模块中被禁止。 An unfortunate side effect is that wxPython gui's are also suppressed. 一个不幸的副作用是wxPython gui也被压制了。

Just comment out the last line in the following section of the Packages\\Default\\exec.py file like so: 只需注释掉Packages\\Default\\exec.py文件的以下部分中的最后一行,如下所示:

if os.name == "nt":
    startupinfo = subprocess.STARTUPINFO()
    #startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW

Find the file named python.sublime-build under C:\\Users[USER NAME]\\AppData\\Roaming\\Sublime Text 2\\Packages\\Python\\ 在C:\\ Users [USER NAME] \\ AppData \\ Roaming \\ Sublime Text 2 \\ Packages \\ Python \\下找到名为python.sublime-build的文件

Add the following value "shell":"true" 添加以下值“shell”:“true”
Save the file and run your How to run a wxPython GUI app in Sublime Text 2! 保存文件并运行如何在Sublime Text 2中运行wxPython GUI应用程序!

The action of comment this line actually works: 评论此行的行动实际上有效:

if os.name == "nt":
    startupinfo = subprocess.STARTUPINFO()
    #startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW

The only diference in Window at this moment is the path, the correct path to found the "exec.py" file is: 此时Window中唯一不同的是路径,找到“exec.py”文件的正确路径是:

 C:\Users\YOUR_USER\AppData\Roaming\Sublime Text 2\Packages\Default

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM