简体   繁体   English

使用py2exe将wxpython GUI程序转换为exe

[英]wxpython GUI program to exe using py2exe

I am new to python programming and development. 我是python编程和开发的新手。 After much self study through online tutorials I have been able to make a GUI with wxpython. 通过在线教程进行了许多自学之后,我已经能够使用wxpython制作GUI。 This GUI interacts with a access database in my computer to load list of teams and employees into the comboboxes. 该GUI与我计算机中的访问数据库进行交互,以将团队和员工列表加载到组合框中。

Now my first question is while converting the whole program into a windows exe file can I also include the .accdb file with it...as in I only need to send the exe file to the users and not the database..if yes how. 现在,我的第一个问题是将整个程序转换为Windows exe文件时,我是否也可以包含.accdb文件...因为我只需要将exe文件发送给用户而不是数据库即可。如果是的话。

My second question is... I actually tried converting the program into exe using the py2exe (excluding the database...am not sure how to do that) and I got the .exe file of my program into the "Dist" folder. 我的第二个问题是...我实际上尝试使用py2exe将程序转换为exe(不包括数据库...我不确定该怎么做),然后将程序的.exe文件放入“ Dist”文件夹中。 But when I double click it to run it a black screen (cmd) appears for less than a second and disappears. 但是,当我双击运行它时,黑屏(cmd)会显示不到一秒钟并消失。 Please help me understand the above issue and resolve it. 请帮助我了解上述问题并解决。

am not sure if I have a option of attaching files...then I could have attached my wxpython program for reference. 不知道我是否可以选择附加文件...那么我可以附加我的wxpython程序以供参考。

Thanks in advance. 提前致谢。

Regards, Premanshu 问候,Premanshu

The console could possibly appear if you used the 'console' parameter to setup(). 如果您将'console'参数用于setup(),则控制台可能会出现。 Switch to 'windows' instead if that is the case. 如果是这种情况,请改用“ windows”。 Can't say for sure without seeing your setup.py script. 在没有看到setup.py脚本的情况下无法确定地说。 Possibly your app could also be opening console, but again hard to say without seeing source. 可能您的应用程序也可能正在打开控制台,但又很难看到源代码。 One thing to check is to make sure you are not printing anything to stdout or stderr. 要检查的一件事是确保没有在stdout或stderr中打印任何内容。 You might want to redirect all of stdout and stderr to your log just in case, and do this right at the top of your start script so that if some 3rd party import was writing to stdout you'd be able to capture that. 为了以防万一,您可能希望将所有stdout和stderr重定向到您的日志中,并在开始脚本的顶部执行此操作,这样,如果某些第三方导入正在向stdout写入内容,则可以捕获该日志。

The db is not part of your executable, so py2exe will not do anything with it. db不是可执行文件的一部分,因此py2exe不会对其执行任何操作。 However, you should probably package your application with an installer, and you can make the installer include the db and install it along with the executable. 但是,您可能应该将应用程序与安装程序打包在一起,并且可以使安装程序包含db并将其与可执行文件一起安装。

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

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