Python graphical interface Development programming: WxPython (SIP)

Source: Internet
Author: User

Python provides a library of multiple graphical development interfaces, several common Python GUI libraries are as follows:

    • Tkinter: The Tkinter module (TK interface) is the interface for Python's standard Tk GUI toolkit. Tk and Tkinter can be used on most Unix platforms and can also be applied to Windows and Macintosh systems. Subsequent versions of Tk8.0 can be implemented in a native window style and run well on most platforms.

    • WxPython:WxPython is an open source software, a good set of GUI graphics libraries in the Python language, allowing Python programmers to easily create complete GUI user interfaces with full function keys.

    • Jython: The Jython program can be seamlessly integrated with Java. In addition to some standard modules, Jython uses Java modules. Jython has almost all the modules in the standard Python that do not depend on the C language. For example, Jython's user interface will use SWING,AWT or SWT. Jython can be dynamically or statically compiled into Java bytecode.

Although I have tried Tkinterbefore, but after reading the above narrative, has been completely attracted by WxPython , can not wait to practice, hereby record the individual learning process (Windows system):

First, Wxpython environment installation

The most realistic and practical way to install Pip, and must be used in a manner that will synchronize the installation of dependent packages: pip install-u wxPython

second, Wxpython tasted

As a beginner, must not blindly directly into the subject, it is necessary to go through this stage, can be very good to help understand the basic structure of the content to learn, to determine whether it is worth in-depth study, and how to practice.

Basic Build steps:
    • import wx module
    • Defines an object of an application class
    • Create a top-level window for WX. The object of the Frame class.   gives the construction title and dimension parameters.
    • While other controls can be added to the frame object, But their layout is not manageable. So, put a panel object into the frame.
    • add a static text object to display   ' Hello world ' anywhere inside the window.
    • Activates the frame window through the show () method.
    • Enter the main event loop for the Application object.
#-*-coding:utf-8-*-import Wxapp = wx. APP () window = WX. Frame (None, title = "It Automation-http://www.cnblogs.com/ItAuto/", size = (600,400)) panel = WX. Panel (window) label = WX. Statictext (panel, label = "It Automation", pos = (200,150)) window. Show (True) app. Mainloop ()

  

















































































Python graphical interface Development programming: WxPython (SIP)

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.