Use Python to develop windows desktop programs I. preparations for development
1. boa-constructor-0.6.1.bin.setup.exe
# A wxWidges integrated development environment, such as Delphi, can drag controls directly, and is different from other integrated environments. # it does not conflict with the MainLoop of the integrated development environment, using pythonwin, pyScripter conflicts. a typical error is that when the second program is run, the forced exit of the integrated development environment is directly caused by the MainLoop conflict.
2. wxPython2.8-win32-unicode-2.8.10.1-py26.exe
# WxPython Library provides the windows Component Library wx written in C ++
3. py2exe-0.6.9.win32-py2.6.exe
# Package and release tools to directly package a windows program or console program written in python into an exe executable file for your use
The above three software are based on python2.6 and must be compatible with the software version because their default installation path is related to the python version. Otherwise, the corresponding library cannot be found.
II. Development
After the software is installed, it is really easy to open the BOA, wow, drag control, and the attribute is similar to Dephi. you only need to modify the attribute, the code will be automatically generated, and the generated control is very beautiful, remember to use
When C ++ 6.0 is developing software, the control is really ugly. I need to re-use the control library to bind the optimization. now I don't need it. the control generated by BOA has a very good visual effect, developing software is fast and never again
You do not need to write too much code for the software interface, or generate many files to generate a small program. python-developed programs have no redundant files, and the files are small.
III. release
Many people want to publish their software programs to others. On the one hand, they do not want their code to be leaked. on the other hand, they want to show a sense of accomplishment. you can use py2exe to share your
Windows program package and release! Of course, you must first write the following setup. py file:
from distutils.core import setup import py2exe includes = ["encodings", "encodings.*"] options = {"py2exe": { "compressed": 1, "optimize": 2, "includes": includes, "bundle_files": 1 } } setup( version = "0.1.0", description = "windows program", name = "winsetup", options = options, zipfile=None, windows=[{"script": "myscript.py", "icon_resources": [(1, "PyCrust.ico")] }], )
You can run python setup. py py2exe in the command line. then you will find your application in the dist folder. Congratulations!
The above describes how to develop a windows desktop program using Python. For more information, see other related articles in the first PHP community!