Питон как сделать всплывающее окно pyqt
Перейти к содержимому

Питон как сделать всплывающее окно pyqt

  • автор:

Урок #4 – Всплывающие окна (QMessageBox)

Урок #4 – Всплывающие окна (QMessageBox)

Всплывающие окна невероятно полезны при разработке настольных приложений. В уроке мы научимся создавать и кастомизировать всплывающие окна на основе класса QMessageBox.

Видеоурок

Для создания всплывающих окон в PyQt 5 используется класс QMessageBox. Вам требуется создать объект на основе класса, добавить к нему характеристики и далее отобразить окно.

Пример кода для реализации окна представлен ниже:

msg = QMessageBox() msg.setWindowTitle("Название окна") msg.setText("Описание") msg.setIcon(QMessageBox.Warning) msg.exec_()

PyQt — Introduction

PyQt is a GUI widgets toolkit. It is a Python interface for Qt, one of the most powerful, and popular cross-platform GUI library. PyQt was developed by RiverBank Computing Ltd. The latest version of PyQt can be downloaded from its official website − riverbankcomputing.com

PyQt API is a set of modules containing a large number of classes and functions. While QtCore module contains non-GUI functionality for working with file and directory etc., QtGui module contains all the graphical controls. In addition, there are modules for working with XML (QtXml), SVG (QtSvg), and SQL (QtSql), etc.

Supporting Environments

PyQt is compatible with all the popular operating systems including Windows, Linux, and Mac OS. It is dual licensed, available under GPL as well as commercial license.

Windows

You can download and install an appropriate installer from the above download link corresponding to Python version (2.7 or 3.4) and hardware architecture (32 bit or 64 bit). Note that there are two versions of PyQt that are available namely, PyQt 4.8 and PyQt 5.5.

While PyQt4 is available for Python 2 as well as Python 3, PyQt5 can be used along with Python 3.* only.

PyQt4 Windows Binaries

PyQt4-4.11.4-gpl-Py3.4-Qt4.8.7-x64.exe Windows 64 bit installer
PyQt4-4.11.4-gpl-Py3.4-Qt4.8.7-x32.exe Windows 32 bit installer
PyQt4-4.11.4-gpl-Py3.4-Qt5.5.0-x64.exe Windows 64 bit installer
PyQt4-4.11.4-gpl-Py3.4-Qt5.5.0-x32.exe Windows 32 bit installer
PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x64.exe Windows 64 bit installer
PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x32.exe Windows 32 bit installer

PyQt5 Windows Binaries

PyQt5-5.5-gpl-Py3.4-Qt5.5.0-x64.exe Windows 64 bit installer
PyQt5-5.5-gpl-Py3.4-Qt5.5.0-x32.exe Windows 32 bit installer

Linux

For Ubuntu or any other debian Linux distribution, use the following command to install PyQt −

sudo apt-get install python-qt4 or sudo apt-get install pyqt5-dev-tools

You can also build from the source code available on the ‘download’ page.

PyQt-x11-gpl-4.11.4.tar.gz Linux, UNIX source for PyQt4
PyQt-gpl-5.5.tar.gz Linux, UNIX, MacOS/X source for PyQt5

PyQt

The GPL licensed Python bindings for the Qt application framework

Brought to you by: philthompson10
Downloads: 830 This Week
Last Update: 2019-03-20

PyQt is the Python bindings for Digia’s Qt cross-platform application development framework. It supports Python v2 and v3 and Qt v4 and Qt v5. PyQt is available under the GPL and commercial licenses. The Sourceforge project is the repository for the GPL source and binary packages.

Project Activity

Follow PyQt

Other Useful Business Software

Built on a modular architecture, OpenDQ scales with your enterprise data management needs.

Infosolve’s Zero Based Solutions provide clients with comprehensive data solutions that leverage the power of their enterprise data to achieve their business objectives and create strategic opportunities— without the burdens of cumbersome licensing agreements, complex term contracts and expensive hardware requirements. Infosolve Technologies embodies its Zero Based Solutions in every project with the Zero defect data guarantee, assuring that all results are free from new data errors and inconsistencies.

Rate This Project

User Ratings

4.5 out of 5 stars
ease 1 of 5 2 of 5 3 of 5 4 of 5 5 of 5 4 / 5
features 1 of 5 2 of 5 3 of 5 4 of 5 5 of 5 4 / 5
design 1 of 5 2 of 5 3 of 5 4 of 5 5 of 5 4 / 5
support 1 of 5 2 of 5 3 of 5 4 of 5 5 of 5 4 / 5

User Reviews

Filter Reviews:
georgewonn Posted 2018-10-30

PyQt is very important in order to develop GUI apps using Python, because Qt is the most mature cross-platform GUI framework.

leptoid Posted 2017-04-02
i couldn’t get it to build, so thanks!
iloveufly Edited 2016-07-14

PyQt5-5.6-gpl-Py3.5-Qt5.6.0-x32-2.exe Use webchannel javascript return value is not valid and invalid transfer object

n1ho Posted 2016-02-11

Wither geolocation.h ? Spent quite a bit of time downloading configuring and attempting to build PyQt-gpl-5.5.1 on an iMac running El Capitan with the latest Xcode installed, as well as the latest Qt for Mac installation. Ended up with: fatal error: ‘qgeolocation.h’ file not found Rather annoying to have to do all this building in the first place — a binary drop for Mac OS X (.app) would be nice(r).

seandhunt7 Edited 2015-10-31

Can you guys please make a installer for Python 2.7.10 so I can install QScintilla2 Without needing to compile it I do not want to compile it I just want to install it to use code that allows me to convert Python Code to C++, although it would generate cpp files and I need .c files AKA Distern C Code for use in C++ 6.0. I wish it was a option to generate *.cpp or *.c and *.h. Ease 3 because of the methods to obtain QScintilla2 is bad it needs a installer exe.and it needs a way to install it using pip as well. qwq I will change my rating and the rest when this is changed (at least the installer for QScintilla2 to be simply installed like the rest of the Qt things or at least package QScintilla2 with Qt4 and Qt5. And SIP needs a simple installer as well.

Урок #4 – Всплывающие окна (QMessageBox)

Урок #4 – Всплывающие окна (QMessageBox)

Всплывающие окна невероятно полезны при разработке настольных приложений. В уроке мы научимся создавать и кастомизировать всплывающие окна на основе класса QMessageBox.

Видеоурок

Для создания всплывающих окон в PyQt 5 используется класс QMessageBox. Вам требуется создать объект на основе класса, добавить к нему характеристики и далее отобразить окно.

Пример кода для реализации окна представлен ниже:

msg = QMessageBox() msg.setWindowTitle("Название окна") msg.setText("Описание") msg.setIcon(QMessageBox.Warning) msg.exec_()

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *