Python can write win programs. The format of win program is exe, let's take a look at the method of writing exe program using python.
After the python program is written, the py2exe module can be packaged as an exe program.
Actual operation process:
1、 Create a file in the same directory of app.py, add, delete, or modify the content of setup.py as needed,
# setup.py
import sys, os
from cx_Freeze import setup, Executable
__ version__ ="1.1.0"
# include_files =['logging.ini','config.ini','running.png']
include_files =[]
excludes =["tkinter"]
# packages =["os","idna","requests","json","base64","pyodbc"]
packages =["os","idna","requests","json","base64"]setup(
name ="appname",
description='App Description',
version=__version__,
options ={"build_exe":{'packages': packages,'include_files': include_files,'excludes': excludes,'include_msvcr': True,}},
executables =[Executable("boxLayout.py",base="Win32GUI")])
2、 Excuting an order
python setup.py bdist_msi
Then generate two folders, build and dist
Find the generated exe file in build\exe.win32-3.6
Content supplement:
Use Python to develop windows desktop programs
Preparation for development
A wxWidges integrated development environment, as simple as Delphi, can directly drag and drop controls, and is different from other integrated environments. #It does not conflict with the MainLoop of the integrated development environment. Pythonwin and pyScripter will conflict. The typical error is to run the second time #Program time, directly lead to integrated development### 1. Pre-development preparation
A wxWidges integrated development environment, as simple as Delphi, can directly drag and drop controls, and is different from other integrated environments. #It does not conflict with the MainLoop of the integrated development environment. Pythonwin and pyScripter will conflict. The typical error is to run the second time #Program, it directly leads to the forced exit of the integrated development environment, because the MainLoop conflicts
wxPython library, provides windows component library wx written in C++
Package release tool, directly package windows program or console program written in python into exe executable file for users to use
The above three softwares are all based on python2.6, the software version must be matched, because their default installation path is related to the python version, otherwise the relevant library will not be found.
So far, this article on how to write win programs in python is introduced. For more related python can write win programs, please search for ZaLou.Cn's previous articles or continue to browse the related articles below. Hope you will support ZaLou more in the future. Cn!
Recommended Posts