Install Pyqt5 under Ubuntu

Source: Internet
Author: User

On the internet to see a lot of Ubuntu system installed PYQT5, feel a little trouble.

The main library has only one: PYTHON3-PYQT5

Can be installed by a new installation or by a shell command

sudo Install PYTHON3-PYQT5

You can use it after installation. Design the form, and then the next Qtdesinger.

One of the simplest small examples: show a form

#!/bin/env Python3#-*-coding:utf-8-*-ImportSYS fromPyqt5.qtwidgetsImportqapplication, Qwidget #导入相应的包if __name__=='__main__': App=qapplication (SYS.ARGV) #创建QApplication对象是必须, management of the entire program, parameters are optional, some words can receive command line parameters W=qwidget () #创建窗体对象, w.resize (250, 150) #设置窗体大小w.move (100, 300) #设置在屏幕上的显示位置w.setwindowtitle (' Simple') #设置窗口标题w.show () #窗口显示sys.exit (app.exec_ ()) 

Sys.exit (APP.EXEC_ ()) Finally, we create a loop (Mainloop) of this application principal, which begins to process "events", which receive events from the window interface and assign them to the application's Widget object. If we call the exit () method, the window's body loop ends and the in-Memory widget object is destroyed, and the Sys.exit () method ensures the reliability of exit and cleanup, and the system environment is told how the application should end.


Install Pyqt5 under Ubuntu

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.