Python graphical interface development and programming: wxPython (simple introduction), development and programming wxpython
Python provides a library for multiple graphical development interfaces. Several Common Python GUI Libraries are as follows:
-
Tkinter:Tkinter module (Tk Interface) is the interface of Python's standard Tk GUI toolkit. Tk and Tkinter can be used on most Unix platforms, and can also be used in Windows and Macintosh systems. Later versions of Tk8.0 can implement the local window style and run well on most platforms.
-
WxPython:WxPython is an open-source software and a set of excellent GUI graphics libraries in Python. It allows Python programmers to easily create a complete GUI with full function keys.
-
Jython:Jython programs can be seamlessly integrated with Java. In addition to some standard modules, Jython uses Java modules. Jython has almost all modules in standard Python that do not depend on the C language. For example, the Jython user interface uses Swing, AWT, or SWT. Jython can be dynamically or statically compiled into Java bytecode.
Although I have triedTkinterBut after reading the above descriptionWxPythonI want to learn more about my learning process (windows ):
I. wxPython environment Installation
The most practical and practical Installation Method pip, which must be used to, will install related dependent packages synchronously: pip install-U wxPython
Ii. wxPython
As a beginner, you must not blindly enter the subject directly. At this stage, you can understand the basic structure of the content you want to learn, and determine whether it is worth further study and how to practice it.
Basic building steps:
- Import wx Module
- Define an object of an application class
- Create a wx. Frame class object in the top-level window. The construction title and size parameters are given.
- Although other controls can be added to Frame objects, their layout cannot be managed. Therefore, we need to add a Panel object to the framework.
- Add a static text object to display any location of 'Hello World' in the window.
- Activate the Framework Window using the show () method.
- Enter the main event loop of 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 ()