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 to persuade visuals_at to look beyond ViewBox?

I'm currently evaluating vispy for my interactive plotting needs. While it feels a bit beta-ish I'm rather impressed with its speed. Also API design-wise it looks promising. One feature I'd need to work is picking plot elements with the mouse. There…
Paul Panzer
  • 51,835
  • 3
  • 54
  • 99
4
votes
1 answer

Restore zoom to default level after mouse interactions in pyqtgraph

Is there a way to restore the default zoom level for pyqtgraph plots. I know about the small button that is displayed in the plot (bottom left corner of the plot) that restores the default zoom level. What I need is I want to restore it (after I…
tonyjosi
  • 717
  • 1
  • 9
  • 17
4
votes
1 answer

PyQt4 can't import Qsci

I'm installing PyQt4 on an old Linux system (CentOS 4.4) that can't be upgraded for hardware compatibility reasons. I've got Python 2.6, QT4 and SIP installed, and the installation of PyQt4 didn't give me any errors. When I run Python, this…
nmichaels
  • 49,466
  • 12
  • 107
  • 135
4
votes
2 answers

PyQt5: pop-up progressbar using QThread

How can I implement a progress bar in a pop-up window that monitors the progress of a running function from a so-called Worker class (i.e. time/CPU-consuming task) by means of a QThread? I have checked countless examples and tutorials, but the fact…
rubebop
  • 392
  • 1
  • 7
  • 17
4
votes
1 answer

How do I get the axis labels in QtChart QLineSeries

I am able to generate graphs using the QtCharts library in Python but I can't seem to figure out how to add axis labels to my graphs... I see the ability to setLabelFormat() for a QValueAxis, but nothing on how to set the text itself. I'm sure…
skbeez
  • 89
  • 2
  • 8
4
votes
1 answer

How do I align centre image on QLabel in PyQt5?

I am currently doing some basic excerises. I'm trying to rewrite some application in which I used tkinter to do the same with PyQt5. Everything works apart from one problem - I have a QLabel containing image and I'm trying to align the image in the…
cyanidem
  • 103
  • 2
  • 9
4
votes
1 answer

How to format Y-axis displayed numbers in pyqtgraph?

I see numbers on Y-axis like this: 1.935 1.9325 1.93 1.9275 1.925 But I need to see this: 1.9350 1.9325 1.9300 1.9275 1.9250 How can I set the AxisItem to show always fixed number of digits after decimal point?
Kroll
  • 649
  • 2
  • 6
  • 17
4
votes
1 answer

PyQT: get real time print output in window

I'm working on a GUI for calling a function 'my_function' when the button 'my_button' is pushed. This function processes data iteratively. It contains a 'for' loop, and at each iteration it prints out a message that shows the progress of my…
Manu
  • 186
  • 3
  • 11
4
votes
1 answer

Updates can only be scheduled from GUI thread or from QQuickItem::updatePaintNode()

I'm trying to change Image with Pushbutton (GPIO PINs) stored inside a folder using QML with PyQt5 Python Code: from gpiozero import Button from signal import pause from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtQml import…
Shivakumar
  • 65
  • 4
4
votes
1 answer

Segmentation error with PyQt5 QMultimedia on Linux

I am using PyQt5 on Ubuntu 18.04.3 LTS. I'm trying to play a .mp3 file using QtMultimedia.QMediaPlayer. This is my code: import sys from PyQt5 import QtCore, QtMultimedia from PyQt5.QtWidgets import QApplication, QMainWindow class…
Timofey X
  • 73
  • 5
4
votes
2 answers

How do I shut down PyQt's QtApplication correctly?

I don't know the first thing about Qt, but I'm trying to be cheeky and borrow code from elsewhere (http://lateral.netmanagers.com.ar/weblog/posts/BB901.html#disqus_thread). ;) I have a problem. When I run test() the first time, everything works…
Cal Paterson
  • 172
  • 1
  • 9
4
votes
0 answers

What is the proper way to center a PyQT QGroupBox title?

Currently, I am achieving a center-position look using left positioning on the label as such: QGroupBox::title { subcontrol-origin: margin; left: 24px; padding: 0px 2px; } Which achieves this look: The issue here is that this is not…
Libra
  • 2,544
  • 1
  • 8
  • 24
4
votes
1 answer

Warnings when instantiating QWebChannel object in javascript

I have a widget which creates a google maps instance using QWebChannel. When instantiating the QWebChannel within javascript several warnings appear: Property 'accessibleName'' of object 'MapWindow' has no notify signal and is not constant, value…
Evan Brittain
  • 547
  • 5
  • 15
4
votes
1 answer

Can't remove margins from QVBoxLayout

I have set up an image button with some text, but the image does not align with the text due to some extra margins. How can I get rid of these margins? I have tried setting setContentsMargins(0,0,0,0) and setSpacing(0) on various components but it…
4
votes
1 answer

How to find the size of a QGraphicsItem after transformation

I am scaling a QGraphicsItem in some parts of the my pyqt code. In another section of my code when I call self.rect.adjusted(0, 0, 0, 0) it returns the dimensions before transformation. My question is how can I find the dimensions after…
Mark
  • 10,754
  • 20
  • 60
  • 81