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

PyQt5 How To Set TabWidget West But Keep The Text Horizontal

How To Make Text Direction From Left To Right Instade Of Top To Bottom
Derar
  • 97
  • 14
4
votes
1 answer

QWebEngineView: showing load progress

I'm using a QWebEngineView widget with PyQt5 and Python 3.6. I want to show progress, when a page is loading. For demonstration purposes I just do this using print statements (later I want to let a progress bar widget appear, show the progress and…
petro4213
  • 163
  • 9
4
votes
0 answers

What's the best method to refresh a QSqlQueryModel?(PYQT5)

I use QSqlQueryModel.setQuery() method to read data from two tables in a MYSQL database, and set the QSqlQueryModel object to a QTableView object. For some reason I'll alter some data in the MYSQL tables by using QSqlQuery.exe() method, but the…
asdzxc
  • 59
  • 5
4
votes
1 answer

PyQt get value from GUI

I've built an User Interface using QtDesigner and then converted the .ui to .py. The User Interface has different comboBox and textBox from which I want to read the values once the Run button is clicked. Run a function and then populate other text…
Eman
  • 43
  • 1
  • 6
4
votes
1 answer

Qt resize layout during widget property animation

I have an existing application that I am polishing off and I want to add some animation to a few of the widgets. Animating widgets with QPropertyAnimation outside of layouts is easy and fun, however when they are in a layout I am having various…
Spencer
  • 1,931
  • 1
  • 21
  • 44
4
votes
1 answer

Connect QWebEngine to proxy

I created my own proxy to intercept packets on 127.0.0.1:6666, and I want it so all packets sent from QWebEngine gets sent to the proxy. I looked this up and I found a few websites saying to use QNetworkProxy, but it never showed how to get it to…
Bale
  • 553
  • 1
  • 8
  • 19
4
votes
2 answers

Update stylesheet without losing original style

I am creating qpushbuttons with a certain style and then updating the style sheet to color them later on. However when I do this it overwrites the original style. Is there a way I can update or append to the object's stylesheet without losing it or…
riyadude
  • 337
  • 6
  • 18
4
votes
1 answer

Properly handling a keyPressEvent in a Subclassed PyQT LineEdit

So I have a QLineEdit that I want to catch a shift keypress in. Here's my code: class NoteText(QtGui.QLineEdit): def __init__(self, parent): super (NoteText, self).__init__(parent) def keyPressEvent(self, event): if…
Cryptite
  • 1,426
  • 2
  • 28
  • 50
4
votes
1 answer

creating standalone exe using pyinstaller with mayavi import

I have a program that helps visualize some data in 3D by plotting a surface and a cloud of points to see how they relate to the surface. For the visualization I am using mayavi since it was easy to set up and does a better job than matplotlib in 3D.…
user2731076
  • 689
  • 1
  • 6
  • 21
4
votes
1 answer

PyQT5 proper layout alignment

I have following code for my PyQt5 GUI: import sys from PyQt5.QtWidgets import QApplication, QWidget, QCalendarWidget, QMainWindow, QGridLayout, QLayout, QTableWidget, QHeaderView, QLabel, QHBoxLayout, QVBoxLayout, QLineEdit, QComboBox from…
minecraftplayer1234
  • 2,127
  • 4
  • 27
  • 57
4
votes
1 answer

How to use PyQt5 QCompleter for code completion

I want to create a QLineEdit field with basic code completion capability, but so far whenever I select an attribute of an item item.attr, the item. is replaced by attr rather than inserting attr after item.. Furthermore if that attr has…
Aaron
  • 10,133
  • 1
  • 24
  • 40
4
votes
1 answer

How to set values in qml using PyQt5?

From PyQt5 i want to write values into qml. This values change dynamically. For example it in rectangle text value is filed from Pyqt5 Rectangle { width: 75 height: 75 text { values from PyQt5 } }
L..
  • 75
  • 6
4
votes
2 answers

how to set a text as a label when button is clicked?

I want to set text as label when button is clicked. self.labl.setText does work normally, but it doesn't work when it is in button function. I have read all the similar questions here, but still didn't solve the problem :( import sys from…
anna
  • 65
  • 1
  • 1
  • 4
4
votes
1 answer

PyQt QProgressBar not working when I use it with Selenuim

I built a PyQt5 GUI to do some Selenium testing. Everything works as expected, except for the PyQt progress bar. In the first example below, where I use the Selenium browser, the progress bar just jumps to 100%, at the end, when the browser closes.…
Joe T. Boka
  • 6,554
  • 6
  • 29
  • 48
4
votes
3 answers

PyQt5 installation error (QtCore Module Error: Unable to create the C++ code)

I'm trying to install PyQt5 on my PC to have access to QtDesigner. I'm facing following error during the installation: $ python3 configure.py --qmake=/usr/local/Cellar/qt/5.10.1/bin/qmake --sip=/usr/local/Cellar/sip/4.19.8_2/bin/sip Querying qmake…
A.Midany
  • 201
  • 1
  • 5
  • 16