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

Giving a color to single tab consumes too much processing power

After lots of research, I managed to customize the QTabWidget in PyQt5 (Python 3.6) such that I can assign a different color to an arbitrary tab: Yes, I know that one can manipulate certain tabs using CSS-selectors…
K.Mulier
  • 8,069
  • 15
  • 79
  • 141
4
votes
3 answers

How to increase the padding (or margins) for an item/row in a QListWidget?

We're looking for a way to increase the padding (or margins) for a QListWidget we are using in our application. We'd like to increase this for all four directions to give the text in our list some extra space I've looked at the documentation for…
sunyata
  • 1,843
  • 5
  • 27
  • 41
4
votes
2 answers

How to remove the divider between widgets when using `statusBar.addPermanentWidget()`?

Is it possible to remove the divider line between two widgets that were added to the status bar using .addPermanentWidget()? I suspect that it is possible, but I haven't really found any literature on how to proceed. import sys from PyQt5.QtWidgets…
artomason
  • 3,625
  • 5
  • 20
  • 43
4
votes
2 answers

Why does QUndoStack.push() execute QUndoCommand.redo()?

I created a custom QPushButton that allows to pick a color from a menu or a QColorDialog. Since it's part of a "theme" editor, I also added support for a QUndoStack: every time the color of a custom button is changed, it creates a subclass of…
musicamante
  • 41,230
  • 6
  • 33
  • 58
4
votes
1 answer

Increasing the maximum number of connections per host of QtWebKit

Question: How can the default limit of 6 connections per host be increased in QtWebKit? Use case: I've multiple QtWebKit (QWebView) panes displayed by a PySide application. (PyQt would also work the same way.) The default connection limit of 6…
fviktor
  • 2,861
  • 20
  • 24
4
votes
1 answer

How to change QLineEdit spacing between text and its edge

The code below creates a single QLineEdit with its font size set to 9. I would like to make sure there is no spacing between the text and the edge of the LineEdit. What attribute controls the mentioned spacing? from PyQt5.QtWidgets import * app =…
alphanumeric
  • 17,967
  • 64
  • 244
  • 392
4
votes
1 answer

PyQt5 GUI - exe made with PyInstaller doesn't open

I've got a GUI which runs perfectly fine when I execute it from the Anaconda Prompt. I get the following window as output: I have installed pyinstaller using pip, and have then run the line pyinstaller.exe --onefile [my file path]\mytest.py with…
ignoring_gravity
  • 6,677
  • 4
  • 32
  • 65
4
votes
1 answer

Python Create a real circle button in pyqt5

I try to create a circle button but in fact pyqt still creates a square button.All examples found just creates square buttons and put a round image in it but still when i try to hide background of the button it fails.I also try to add some hover…
4
votes
2 answers

Adding a simple clock to a GUI

I have some code for a very generic/blank GUI with some labels and pushbuttons and an LCD widget. I also have some code for a separate window which just uses an LCD widget to display the time. My question is how do I insert to code for the clock…
Chris
  • 53
  • 1
  • 5
4
votes
1 answer

QStandardItem missing __hash__ method

I found when converting some Python2/Qt4 code to Python3/Qt5, that apparently QStandardItem can no longer be used as a dict key in as it doesn't have __hash__ implemented, and therefore is not considered immutable anymore. Those two snippets show…
4
votes
1 answer

How to convert QImage(QPixmap) to PIL Image in Python 3?

I would like to convert a image from QImage or Qpixmap class to PIL Image. I found this: Convert PyQt to PIL image But it seems to doesn't work in Python3. Is the way to implement this to Pyhton3 or do it more simply using new approaches exist?
Nikita Romaniuk
  • 125
  • 2
  • 11
4
votes
9 answers

'pyuic5' is not recognized as an internal or external command

I am trying to convert ui file created by QTDesigner to py file. but i get the error: pyuic5 is not recognized as an internal or external command. I use anaconda 3, and tried all suggestions here: C:/Program is not recognized ...related to…
keramat
  • 4,328
  • 6
  • 25
  • 38
4
votes
3 answers

findChild on object created within pyqt designer

I have the following problem with my pyqt: Assuming i create an object within the Qt Designer and save it as an .ui file. Then i use pyuic to convert it to an .py file. Because i want to integrate a new module into a given program, this is the…
fighter-ii
  • 479
  • 2
  • 6
  • 19
4
votes
3 answers

Is there any way to call synchronously the method 'toHtml' which is QWebEnginePage's object?

I'm trying to get html code from the QWebEnginePage object. According to Qt reference, QWebEnginePage object's 'toHtml' is asynchronous method as below. Asynchronous method to retrieve the page's content as HTML, enclosed in HTML and BODY tags.…
ko.nyk.93
  • 43
  • 4
4
votes
2 answers

how to insert/edit QAbstractListModel in python and qml updates automatically?

i am trying to insert/edit a python list that is subclassed from QAbstractListModel in pyqt5. this python list is read in the model property of ListView element in qml. i have no issues displaying the data in qml. problem arises when i try to…
eugeneoei
  • 210
  • 3
  • 16
1 2 3
99
100