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
2 answers

Select all items in QListView and deselect all when directory is changed

I created a window like this The link! and when I select a directory I would like to select all items in the right Qlist, and when I change to a different directory, I would deselect the items in the previous directory and select all items in my…
Sally
  • 87
  • 2
  • 10
4
votes
2 answers

I'm getting error in pyqt5, while connecting push button

I'm first time using pyqt5. After creating the UI from QT designer, and then converting the UI file to python file, I'm getting error, the strange part is sometimes when i try to recreate the UI from Designer i don't get the error, but sometimes…
user1779646
  • 809
  • 1
  • 8
  • 21
4
votes
1 answer

How to capture mousePressEvent between widgets in a layout?

I'm trying to detect mouse clicks for anywhere inside an area with several widgets. For this I'm using the following code: custom_widget =…
sunyata
  • 1,843
  • 5
  • 27
  • 41
4
votes
1 answer

QStyledItemDelegate to display QComboBox in QTableView

I'm new to Python and PyQt5. I'm using QStyledItemDelegate to make one of the QTableView column consisting of only ComboBox. I managed to display the ComboBox but and I'm having trouble with its behavior. Problem 1: The ComboBox doesn't seems to…
malco
  • 43
  • 1
  • 5
4
votes
1 answer

connecting a pyqtSignal from Qrunnable

I am trying to make an app that monitors hardware, I would like to use Qthreadpool instead of having a thread for each widget and I am having trouble connecting signals to display the output. I am also getting no errors. My old code runs fine and…
fredwntr1
  • 58
  • 1
  • 6
4
votes
1 answer

How to insert a web browser in Python QT Designer

I have created a simple user interface in QT Designer 5 and would like to include a widget that displays a webpage. I use the following code to use the ui file with python: from PyQt5 import uic, QtWidgets import sys app =…
West
  • 2,350
  • 5
  • 31
  • 67
4
votes
2 answers

PyQt5 Image and QGridlayout

I've a Widget, which wants to display Images with QLabel and QCheckBox. 4 classes are created each contains some information to be put on the final screen. Class Grid align and grid images, text and checkboxes. After script running get current…
Pavel.D
  • 561
  • 1
  • 15
  • 41
4
votes
1 answer

Getting black border on white text possible?

So I have a graph tool of sorts using a PyQt5 gui, and giving the user the ability to color nodes and name them. But you can imagine that depending on what color you color the nodes, the text can be illegible. So if there was a way to get a black…
Ned U
  • 401
  • 2
  • 7
  • 15
4
votes
1 answer

QTableWidget respect span when sizing to contents

If I have a QTableWidget, and I set the cell's column span using setSpan, Qt sizes the table as if the contents of the cell are entirely in the first column of the extended cell. from PyQt5 import QtWidgets, QtCore import sys class…
buck54321
  • 847
  • 9
  • 21
4
votes
2 answers

How does stretch factor work in Qt?

I'm working on a GUI application with pyqt5. At a certain dialog I need many components, being one of those a QWebEngineView as a canvas for plotting data, which should take most of the space available even if the chart is not ready when creating…
Roman Rdgz
  • 12,836
  • 41
  • 131
  • 207
4
votes
2 answers

PyQt5 and subprocess.Popen(...)

I have 3 classes One is the Console class: class Console(QWidget): def __init__(self): super().__init__() self.editor = QPlainTextEdit(self) self.editor.setReadOnly(True) self.font = QFont() …
user8513021
4
votes
1 answer

Custom widget in ScrollArea is being squashed!

I have a qscrollarea and within that a qgridlayout. In the grid layout I create a number of custom widgets (for simplicity these widgets are simply a groupbox and a label) and add one on each row. Instead of displaying the vertical scrollbar, the…
Saab
  • 73
  • 5
4
votes
1 answer

PyQt5 QTableWidget Right Click on Cell Won't Spawn QMenu

My program has a table, and there's a desire to be able to right click a cell in said table and have that spawn appropriate actions that will manipulate that cell (different set of actions for different cells). My test code, just has a widget that…
Ned U
  • 401
  • 2
  • 7
  • 15
4
votes
1 answer

How do I queue QProcesses in PyQt5?

I want to queue QProcess in PyQt5 or simply block while still reading the stdout with readAll(). The equivalent of subprocess.call instead of subprocess.Pop. When using waitForFinished() the stdout with readAll() will all come at once when the…
Damuno
  • 161
  • 1
  • 11
4
votes
1 answer

How can I change the QStyle properties in PyQt4?

I'd like to change the QStyle::PM_TabBarTabHSpace property for a PyQt application. I read the Qt document for QStyle, but I'm not sure how to set this correctly in PyQt. Non-working code: style =…
k107
  • 15,882
  • 11
  • 61
  • 59