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

Move icon to right side of text in a QCheckBox

I'm trying to move the icon of a QCheckBox from the left of the label to immediately on the right. I've checked these posts: PyQt4 QPushButton text and icon alignment Align icon on the right and center the text in a QPushButton But neither seem to…
Diziet Asahi
  • 38,379
  • 7
  • 60
  • 75
4
votes
2 answers

How to connect multiple PyQt Signals w/ variable arguments to single slot/signal repeater

Example: class MyClass(QObject): signal_1 = pyqtSignal(str, int) signal_2 = pyqtSignal(int, int) signal_3 = pyqtSignal(str, int, int) Let's say each of these signals is connected elsewhere to perform various functions, however, there's…
Connor Spangler
  • 805
  • 2
  • 12
  • 29
4
votes
1 answer

Qt designer how to set style?

I made an application in Qt designer and I can also preview it in "fusion" style. How can I make it always look like in the "fusion" style? I mean like set it as the standard design. (I'm using Python)
Dom
  • 47
  • 2
  • 7
4
votes
1 answer

Issue in QLineEdit with title()?

In my Programme. use two QLineEdit. First one is normal and second one is titled Line edit. First one/normal QLineEidt works smoothly, But In second textbox(QLineEdit), I cannot insert a text at begging or any where at a time. for example : I…
Bala
  • 648
  • 5
  • 15
4
votes
1 answer

QFrame Background Color overlapped with other Widgets like QLineEdit, QListBoxWidget, etc. How to avoid it?

In my Programme, QLineEdit and QListWidget Placed in QVBoxLayout. And then QVBoxLayout put in a QFrame with Stylesheet of background-color:orange. QLineEdit and QListWidget also get the same background-color of QFrame. How to avoid the background …
Kumar
  • 592
  • 6
  • 18
4
votes
1 answer

QLineEdit change PlaceholderText color

I have a LineEdit widget in an app and its PlaceholderText changes based on the user's input. However, I'd like for the PlaceholderText to look like normal text, i.e. to be black instead of grey. I've looked online but most of the results were…
Thibaut B.
  • 172
  • 1
  • 12
4
votes
1 answer

Pyqt5 deleteLater() VS sip.delete()

I want to understand what is the difference between deleting a widget(include it's layout and children in this layout) using sip.delete() and deleteLater(). I know that removeWidget() and setParent(None) is just removing the widget from layout, but…
Zidan
  • 95
  • 1
  • 12
4
votes
1 answer

Threading with QRunnable - Proper manner of sending bi-directional callbacks

From a tutorial, I've seen that signals and slots can be used to make callbacks from a worker thread into the main GUI thread, but I'm uncertain how to establish bi-directional communication using signals and slots. The following is what I am…
4
votes
1 answer

Put a Matplotlib plot as a QGraphicsItem/into a QGraphicsView

So I have a very basic plot layout described below (with x and y values changed for brevity): import matplotlib.pyplot as plt from matplotlib.figure import Figure import numpy as np figure = Figure() axes = figure.gca() axes.set_title(‘My…
Mathew Major
  • 39
  • 1
  • 3
4
votes
1 answer

What is the best widget in pyqt5 to show a checked list with columns

I am looking for a widget which is a list box, and one entry has different attributes represented by column names. I want to be able to select multiple entries from the list using a check box on the left side. Please, also tell me how to configure…
Ali Sajjad
  • 3,589
  • 1
  • 28
  • 38
4
votes
1 answer

How can i get a video thumbnail using Qt

I am working on a media player and I want to show a preview image as file icon. How can I get the thumbnail of video using Qt or using any Qt tools like QQuick image provider?
4
votes
1 answer

add a layout to another layout from the parent window

I am new to this field, and I Hope this not seems a stupid question I am using PyQt5 for Python 3.8 on mac I want to add a layout(addLayout) to another layout from the parent window if it is possible! This is an example: I have a Class…
Fawaz
  • 83
  • 1
  • 6
4
votes
2 answers

PyQt emulate minimize button "_"

How can I minimize window in PyQt the same way as when _ is pressed? I use self.showMinimized() It really minimizes window. But there is no refocus to the previous window. As if focus is still on minimized window. How can I minimize and refocus…
Qiao
  • 16,565
  • 29
  • 90
  • 117
4
votes
1 answer

How to use the Span Selector on a embedded figure of matplotlib widget?

I am working on GUI where I have a system with graphs. I want to use the spanselector in the graph i do visualize. I have searched and i can't understand how to use the span selector while calling the matplotlib widget. This is an example i'm…
4
votes
1 answer

How to get selected header label from QTableWidget item?

I have a QTableWidget item. I fill this item with pandas DataFrame data. I must print selected column values as a report. I can easily print data from DataFrame. However, I need to know verticalHeader (QTableWidget) labels to get data from…
Ugurcan
  • 366
  • 1
  • 4
  • 17