Use Python to develop windows GUI program entry instances, pythongui

Source: Internet
Author: User

Use Python to develop windows GUI program entry instances, pythongui

I am very happy to finally use wxPython to develop the GUI program. Write down some notes for your reference. On windows XP, configure the following environment:

1. Install python first. After installation, add the directory of python/bin to path.
2. Install wxPython. Note that the wxPython version must be consistent with the previous python version.
3. Install py2exe. This is a very good python program release tool on the windows platform. It can compile the python program into an exe and run it out of the python environment. After the above installation, we can test it.

WxPython demo code:

Copy codeThe Code is as follows:
# 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:

Copy codeThe Code is as follows:
# Setup. py
From distutils. core import setup
Import py2exe

Setup (windows = ["wxDemo. py"])

Note that setup (windows = ["wxDemo. py "]) to correctly reference Your Python program, the python program file to be compiled in [] uses the windows attribute because it contains a window.

Compile as follows:

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 :)


What tools are generally used to develop python programs in windows? Besides the built-in IDLE (python GUI), this is too stamp.

1. There are multiple versions of python that can use pyscripter. Now it is 2.5.3. The disadvantage is that it is easy to crash !?
2. wingide is really easy to use. Currently it is 4.1.10. The disadvantage is that it is charged!
3. eclipse + pydev is also good, that is, the software is relatively large, and the response is slow!
4. pycharm has heard that it is also very good. Currently, it is 2.7. It is based on Java, and the disadvantage is that the charges and huge software response are slow!
5. If textmate2 and Sublime are adapted, they are also very powerful!
5. vi, emacs, editplus? If you can adapt, It is omnipotent. I didn't use it anyway.

Python can develop windows programs

Python is cross-platform and can be used to develop programs on Windows.
For GUI, you can use pyqt, wxpython, pygtk, etc. It is also cross-platform...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.