Questions tagged [pyqt]

PyQt is a set of Python v2 and v3 bindings for The Qt Company's Qt application framework and runs on all platforms supported by Qt including Windows, macOS, Linux, iOS and Android

PyQt Components

PyQt4 contains the following Python modules.

  • The QtCore module contains the core non-GUI classes, including the event loop and Qt's signal and slot mechanism. It also includes platform independent abstractions for Unicode, threads, mapped files, shared memory, regular expressions, and user and application settings

  • The QtGui module contains the majority of the GUI classes. These include a number of table, tree and list classes based on the model-view-controller design pattern. Also provided is a sophisticated 2D canvas widget capable of storing thousands of items including ordinary widgets.

  • The QtHelp module contains classes for creating and viewing searchable documentation and being able to integrate online help with PyQt applications. It is based on the C++ port of the Lucene text search engine.

  • The QtNetwork module contains classes for writing UDP and TCP clients and servers. It includes classes that implement FTP and HTTP clients and support DNS lookups. Network events are integrated with the event loop making it very easy to develop networked applications. The QtOpenGL module contains classes that enable the use of OpenGL in rendering 3D graphics in PyQt applications.

  • The QtScript module contains classes that enable PyQt applications to be scripted using Qt's JavaScript interpreter.

  • The QtSql module contains classes that integrate with open-source and proprietary SQL databases. It includes editable data models for database tables that can be used with GUI classes. It also includes an implementation of SQLite.

  • The QtSvg module contains classes for displaying the contents of SVG files. It supports the static features of SVG 1.2 Tiny.

  • The QtTest module contains functions that enable unit testing of PyQt applications. PyQt does not implement the complete Qt unit test framework. Instead it assumes that the standard Python unit test framework will be used and implements those functions that simulate a user interacting with a GUI.

  • The QtWebKit module implements a web browser engine based on the WebKit open source browser engine used by Apple's Safari. It allows the methods and properties of Python objects to be published and appear as JavaScript objects to scripts embedded in HTML pages.

  • The QtXml module implements SAX and DOM interfaces to Qt's XML parser.

  • The QtXmlPatterns module implements XQuery and XPath support for XML and custom data models.

  • The phonon module implements a multimedia framework that enables the use of audio and video content in PyQt applications. On Windows DirectX is used as the backend, on MacOS/X QuickTime is used as the backend, and on Linux GStreamer is used as the backend.

  • The QtMultimedia module implements low-level multimedia functionality. Application developers would normally use the phonon module.

  • The QtAssistant module implements a simple interface for integrating Qt Assistant with PyQt applications to provide online help. Qt Assistant is itself implemented using QtHelp.

  • The QtDesigner module contains classes that allow Qt Designer to be extended using PyQt.

  • The QAxContainer module implements access to ActiveX controls and COM objects. It is only available in the commercial version of PyQt for Windows.

  • The Qt module consolidates the classes contained in all of the modules described above into a single module. This has the advantage that you don't have to worry about which underlying module contains a particular class. It has the disadvantage that it loads the whole of the Qt framework, thereby increasing the memory footprint of an application. Whether you use this consolidated module, or the individual component modules is down to personal taste.

  • The DBus support module is installed as dbus.mainloop.qt. PyQt does not support Qt's native DBus classes. Instead the module enables the Qt event loop to be used with the standard DBus Python bindings. It is only available for PyQt for X11.

  • The uic module implements support for handling the XML files created by Qt Designer that describe the whole or part of a graphical user interface. It includes classes that load an XML file and render it directly, and classes that generate Python code from an XML file for later execution.

PyQt Documentation

Current documentation is available for PyQt4 and PyQt5.

Books about PyQt

A list of tutorials

IDE for PYQT

16996 questions
4
votes
1 answer

How do i use QComboBox.setPlaceholderText?

In Qt 5.15 the placeholderText property was introduced - link to documentation However using setPlaceholderText doesn't do anything for me. When running the code below i don't get any text in the QComboBox (unless of course i select one of the three…
sunyata
  • 1,843
  • 5
  • 27
  • 41
4
votes
1 answer

Detect mouse clicks on QWebEngineView

How can I detect mouse clicks in QWebEngineView widget? I tried this but doesn't work: class MyWin(QtWidgets.QMainWindow): def __init__(self, parent=None): QtWidgets.QWidget.__init__(self, parent) self.ui = Ui_MainWindow() …
4
votes
2 answers

QT widget signals - comprehensive list?

Looking for a comprehensive listing of the various SIGNALS emitted by the built in QT4 widgets. Have looked around - can't seem to find one. (Using PyQT 4.x and Python 3.2) TIA
Vector
  • 10,879
  • 12
  • 61
  • 101
4
votes
3 answers

Is it possible to use pyqtgraph functions to plot inline on Jupyter Notebook?

I am trying to use Pyqtgraph to plot some image arrays on Jupyter notebook, but I am having some problems. Basically, I'm using the following code: import pyqtgraph as pg %gui qt pg.image(recon_array_a[0]) This is giving me what I need but is…
Gabriel Schubert
  • 165
  • 4
  • 12
4
votes
2 answers

Unable to install PyQt5 on Raspberry Pi

I am trying to install PyQt5 on my Raspberry Pi machine. I have tried: pip3 install pyqt5 pip3 install --upgrade pip pip3 install pyqt5==5.14.0 sudo apt-get update sudo apt-get install python3-pyqt5 they all give me the error: Using cached…
asohasf1241
  • 195
  • 1
  • 10
4
votes
1 answer

How to play a numpy array in Qt without saving it to a file?

QMediaPlayer can be used to play a music file i.e., *.wav, *.mp3, etc. But can I use it to play a wave recorded in an array? From the official documentation, I found QMediaPlayer::setMedia has a parameter stream. I guess this API can be used to play…
Scientific.RAT
  • 134
  • 1
  • 1
  • 9
4
votes
2 answers

How to resize a window from the edges after adding the property QtCore.Qt.FramelessWindowHint

Good night. I have seen some programs with new borderless designs and still you can make use of resizing. At the moment I know that to remove the borders of a pyqt program we use: QtCore.Qt.FramelessWindowHint And that to change the size of a window…
4
votes
1 answer

Changing the color of a QProgressbar()

I was wondering whether it's possible to change the color of a PyQt Progressbar? I have the following code: from PyQt4 import QtGui, QtCore Pbar1 = QtGui.QProgressBar() Pbar1.setParent(Frame1) Pbar1.setGeometry(0, 0, 306,…
Marcel Hoving
  • 65
  • 1
  • 1
  • 3
4
votes
1 answer

Check which button in an QMessageBox was clicked

How should I check which one of the buttons in the following QMessageBox was clicked? The button == QMessageBox.Ok is not working. class WarningWindow(QMessageBox): nextWindowSignal = pyqtSignal() def __init__(self): …
dvilela
  • 1,200
  • 12
  • 29
4
votes
1 answer

PyQT terminal emulator

I am trying to develop a "console" in pyqt. Similar to xterm.js where all the console is, is front end it does not spawn any sub-processes its just an I/O for me to plug in whatever I want to at a later date. are there any existing python packages…
TheHidden
  • 551
  • 1
  • 8
  • 20
4
votes
2 answers

What is the right way to use PostgreSQL with PyQt5

I use PostgreSQL 9.6.17 (installed on Linux server on LAN) and have Win10 (or Win7) clients with installed Python 3.7 or 3.8 and PyQt 5.13.2, and my PyQt5 app that uses that PostgreSQL server works ok, but I really don't know what I'm doing. I'll…
nenad
  • 164
  • 6
  • 17
4
votes
2 answers

How to receive hover events for child widgets?

I have a QWidget containing another (child) widget for which I'd like to process hoverEnterEvent and hoverLeaveEvent. The documentation mentions that Mouse events occur when a mouse cursor is moved into, out of, or within a widget, and if the…
a_guest
  • 34,165
  • 12
  • 64
  • 118
4
votes
1 answer

How to change the background color of a QScrollArea without affecting the scrollbar color?

I'm using self.setStyleSheet("background-color: white") to change the background color of a QScrollArea in PyQt5, but that also affects the scroll bar. What is the proper way of just changing the area background color? import sys from…
dvilela
  • 1,200
  • 12
  • 29
4
votes
1 answer

Change Qt Stylesheet for all Instances of a Widget

Using PyQt, is there any way to change the stylesheet for every instance of a widget without having to manually change each widget's stylesheet. Say, for instance, I wanted every pushbutton in my application to have red text. How would I do this…
HatHat556
  • 91
  • 1
  • 8
4
votes
1 answer

How to show progress bar while saving file to excel in python?

Appreciate if you could help me. I have a trouble showing up the progress bar while saving file to excel. What I want to achieve is to show a progress bar while saving excel file from a pandas dataframe also from qwidgettable as it takes time before…