How in Python GUI desktop development? What good library can recommend?

GUI development in Python libraries fact, many, Now I will briefly introduce a few good libraries, interested friends can try it yourself, experimental environment win10 + python3.6 + pycharm5.0, the following key elements:

tkinter

Needless to say this, python GUI development comes with standard libraries for the development of small, simple application, completely, and open source, cross platform, ease of use, following my simple test, the main code is as follows:

Click to run the program, the effect is as follows, a window of a Label Tags:

easygui

This is based on tkinter a window GUI library, you can quickly create a window box, including common login dialog box registration, etc. Now I will briefly introduce the installation and use of this library:

1. First, install EasyGUI, the direct input window installation command cmd "pip install easygui" on the line, as follows:

2. After installation is complete, we can directly write test code, the main code is as follows, is very simple:

Click to run this program, the effect is as follows:

discouraged

This is a cross-platform GUI application development library that can be used to develop Android, Apple's application, a program that can run everywhere, here I briefly introduce the installation and use of this library:

1. First, install kivy, the press official tutorial installed on the line, as follows:

2. After installation is complete, you can write directly test the code, mainly the following code is very simple:

Click to run the program, the effect is as follows, where you can be packaged as a mobile application installed on the phone:

wxpython

This is a free, cross-platform Python GUI development library, compared to the previous tkinter, the more powerful but also more control, here I briefly introduce the installation and use of this library:

1. First, wxPython installation, this also directly enter the command "pip install wxpython" cmd window in the line, as follows:

2. After installation is complete, we can write the code to test directly related to the main code is as follows, very simple, a simple text editor:

Click to run this program, the effect is as follows:

pyqt

这个Qt的一个Python接口库,借助于Qt强大的用户界面,Python也可以快速开发出GUI程序,组件更多,也更方便,只要你有一定的Qt基础,很快就能掌握这个库的使用,下面我简单介绍一下这个库的安装和使用:

1.首先,安装pyqt,这个直接在cmd窗口输入安装命令“pip install pyqt5”就行,如下,安装需要稍微等待一会儿:

2.安装完成后,我们就可以直接编写代码进行测试了,如下,一个简单的计算器:

点击运行这个程序,效果如下:

至此,我们就介绍完了这5个Python GUI库。总的来说,这5个库使用起来都非常不错,如果你的应用界面比较简单,功能要求不高,可以选择tkinter和easygui,如果界面比较复杂,功能要求比较复杂,可以考虑使用wxpython或pyqt,当然,你也可以使用其他GUI库,像pygame等,根据实际项目需求而定,网上也有相关资料和教程,感兴趣的话,可以搜一下,希望以上分享的内容能对你有所帮助吧,也欢迎大家评论、留言。

 

 

 

 

发布了80 篇原创文章 · 获赞 4 · 访问量 1万+

Guess you like

Origin blog.csdn.net/tscaxx/article/details/104103336