The following articles describe the application code for developing windows programs using python, the related steps in practical applications, and the actual application solution for installing py2exe, the following is a detailed description of the article. I hope you will get some benefits.
Install py2exe. This is the next very good python program release tool on the windows platform. You can compile the python program into an exe and run it out of the python environment.
WxPython demo code:
Python code
- #wxDemo.py
- import wx
- class App(wx.App):
- def OnInit(self):
- frame = wx.Frame(parent=None, title='Bare')
- frame.Show()
- return True
- app = App()
- app.MainLoop()
- #wxDemo.py
- import wx
- class App(wx.App):
- def OnInit(self):
- frame = wx.Frame(parent=None, title='Bare')
- frame.Show()
- return True
- app = App()
- app.MainLoop()
-
Compile the compilation code for py2exe:
Python code
- #setup.py
- from distutils.core import setup
- import py2exe
- setup(windows=["wxDemo.py"])
- #setup.py
- from distutils.core import setup
- import py2exe
- setup(windows=["wxDemo.py"])
-
Run python setup. py py2exe on the command line and put the handler in the same directory. Otherwise, the program cannot be executed. Now, double-click wxdemo.exe and you will see a window. The following describes how to develop a windows program using python.