


Seven essential GUI libraries for Python, you must learn them this time!
GUI (Graphical User Interface), as the name suggests, uses graphics to display the computer operation interface. , more convenient and intuitive.
Corresponding to it is CUI (Command Line User Interaction), which is a common Dos command line operation. You need to memorize some commonly used commands. For ordinary people, it is quite difficult to learn how to operate them.
A good-looking and easy-to-use GUI can greatly improve everyone’s experience and efficiency.
For example, if you want to develop a calculator, if it is just a program input and output window, there will be no user experience. .
So it becomes necessary to develop a small graphical window.
Today, Xiao F will introduce to you seven essential GUI libraries for Python, each of which is worth learning.
##01. PyQt5
PyQt combines Qt and Python. It's not just a GUI toolkit. Also included are threads, Unicode, regular expressions, SQL databases, SVG, OpenGL, XML and a full-featured web browser, as well as many rich collections of GUI widgets.
Use pip to install it.
1 2 |
|
After successful installation, here is a simple example of Hello Word.
##
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
##Document address:
https://riverbankcomputing.com/software/pyqt/intro
Tutorial link:
https://www.guru99.com/pyqt-tutorial.html
##02. Tkinter
Tkinter is one of the most popular GUI libraries in Python. Due to itssimple and easy-to-learn syntax, it has become one of the first choices for GUI development beginners .
Tkinter provides various widgets such as labels, buttons, text fields, checkboxes and scroll buttons, etc. .
Supports Grid (grid) layout. Since most of our programs are displayed in rectangles, even complex designs can be developed easily. Become simpler.
1 2 |
|
下面使用Tkinter设计一个BMI计算器。
以重量和高度作为输入,并在弹出框中返回BMI系数作为输出。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
界面如下。
When there is no data, click the BMI button and there will be a corresponding prompt.
Let’s use the correct data to see the results.
#It feels good to use.
#03. Kivy
Kivy是另一个开源的Python库,最大的优点就是可以快速地编写移动应用程序(手机)。
Kivy可以在不同的平台上运行,包括Windows、Mac OS、Linux、Android、iOS和树莓派。
此外也是免费使用的,获得了MIT许可。
1 2 |
|
一个基于Kivy的Hello World窗口。
1 2 3 4 5 6 7 8 |
|
结果如下。
04. wxPython
wxPython是一个跨平台GUI的Python库,可轻松创建功能强大稳定的GUI,毕竟是用C++编写的~
目前,支持Windows,Mac OS X,macOS和Linux。
使用wxPython创建的应用程序(GUI)在所有平台上都具有原生外观。
1 2 |
|
下面使用wxPython创建一个基本的GUI示例。
1 2 3 4 5 6 7 |
|
结果如下。
Documentation link:https://www.wxpython.org/
##05. PySimpleGUI
PySimpleGUI is also a GUI framework based on Python. Can easily make customized GUI.
Adopts the four most popular GUI frameworks QT, Tkinter, WxPython and Remi, which can implement most sample codes and reduce The learning difficulty is .
Remi将应用程序的界面转换为HTML,以便在Web浏览器中呈现。
1 2 |
|
下面是一个简单的案例。
1 2 3 4 5 6 7 8 9 |
|
结果如下。
Click the OK button and the window disappears.
#06. PyGUI
##PyGUI is a GUI framework known for its simple API, which reduces the gap between Python applications and the underlying GUI of the platform amount of code.
##Lightweight API can make your application run more smoothly. Faster.
At the same time, it also provides open source code and cross-platform projects. Currently runs on Unix-based systems, Windows and Mac OS.
Python2 and Python3 are both supported.
Document address:
https: //www.cosc.canterbury.ac.nz/greg.ewing/python_gui/
Tutorial link:
https://realpython.com/pysimplegui-python/
07. Pyforms
##Pyforms is a cross-platform framework for developing GUI applications.
1 2 |
|
文档地址:https://pyforms.readthedocs.io/en/v4/
The above is the detailed content of Seven essential GUI libraries for Python, you must learn them this time!. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics





PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

VS Code can be used to write Python and provides many features that make it an ideal tool for developing Python applications. It allows users to: install Python extensions to get functions such as code completion, syntax highlighting, and debugging. Use the debugger to track code step by step, find and fix errors. Integrate Git for version control. Use code formatting tools to maintain code consistency. Use the Linting tool to spot potential problems ahead of time.

VS Code can run on Windows 8, but the experience may not be great. First make sure the system has been updated to the latest patch, then download the VS Code installation package that matches the system architecture and install it as prompted. After installation, be aware that some extensions may be incompatible with Windows 8 and need to look for alternative extensions or use newer Windows systems in a virtual machine. Install the necessary extensions to check whether they work properly. Although VS Code is feasible on Windows 8, it is recommended to upgrade to a newer Windows system for a better development experience and security.

VS Code extensions pose malicious risks, such as hiding malicious code, exploiting vulnerabilities, and masturbating as legitimate extensions. Methods to identify malicious extensions include: checking publishers, reading comments, checking code, and installing with caution. Security measures also include: security awareness, good habits, regular updates and antivirus software.

Python is more suitable for beginners, with a smooth learning curve and concise syntax; JavaScript is suitable for front-end development, with a steep learning curve and flexible syntax. 1. Python syntax is intuitive and suitable for data science and back-end development. 2. JavaScript is flexible and widely used in front-end and server-side programming.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

In VS Code, you can run the program in the terminal through the following steps: Prepare the code and open the integrated terminal to ensure that the code directory is consistent with the terminal working directory. Select the run command according to the programming language (such as Python's python your_file_name.py) to check whether it runs successfully and resolve errors. Use the debugger to improve debugging efficiency.
