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
17
votes
4 answers

How to add a row in a tableWidget PyQT?

I am currently working on a widget that was designed in Qt Designer. I am having trouble with the syntax / overall concept of trying to add a row to a Qtable in PyQT. There is no method, which I have yet found to dynamically add rows. Any…
sudobangbang
  • 1,406
  • 10
  • 32
  • 55
17
votes
3 answers

Binding a PyQT/PySide widget to a local variable in Python

I'm pretty new to PySide/PyQt, I'm coming from C#/WPF. I've googled alot on this topic but it no good answer seems to show up. Ii want to ask is there a way where I can bind/connect a QWidget to a local variable, whereby each object update…
Temitayo
  • 802
  • 2
  • 12
  • 28
17
votes
2 answers

Is deleteLater() necessary in PyQt/PySide?

Since there is already a Garbage Collector in Python, is deleteLater() necessary in PyQt/PySide?
iMath
  • 2,326
  • 2
  • 43
  • 75
17
votes
5 answers

PYQT4 - How do I compile and import a qrc file into my program?

I'm having trouble importing a resource file. I'm using pyqt4 with monkey studio and I am trying to import a png image. When I run the program I get an import error like ImportError: No module named icon_rc I know that I have to compile it using…
Thomas
  • 1,199
  • 3
  • 13
  • 25
16
votes
2 answers

How to customize title bar and window of desktop application

How could I customize the Title Bar (including: close, maximize, minimize buttons, title) and the Frame of desktop application written in PyQt so that it looks like the below image?. I need a way to specify the colors I want to use for title bar…
iraj jelodari
  • 3,118
  • 3
  • 35
  • 45
16
votes
1 answer

PyInstaller creates slow executable

I'm using PyInstaller to create a single executable of a python program using PyQt. It creates the .exe and runs fine, but takes between 15 to 20 seconds to start. I thought I could get by with creating a splash screen so the user would at least…
Stephen
  • 663
  • 5
  • 13
  • 24
16
votes
4 answers

Can't install PyQt5 using pip

I have tried to install PyQt5 using pip install PyQt5 and sudo -H pip install PyQt5 both of them give me the errors ERROR: Could not find a version that satisfies the requirement PyQt5 (from versions: none) ERROR: No matching distribution found…
rsaavedra
  • 378
  • 1
  • 4
  • 12
16
votes
6 answers

No module named PyQt5.sip

After upgrading to python-pyqt5 5.12-2 I get this error when I try to import from QtWidgets from PyQt5.QtWidgets import * Error: Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named…
Holderekt
  • 161
  • 1
  • 1
  • 5
16
votes
2 answers

How can I hide the console window in a PyQt app running on Windows?

Surely this is possible? I have been hunting through PyQt tutorials and documentation but cannot find the answer to it. Probably I just need to phrase my search query differently. [Edit] Thanks PEZ for the answer - more details including use of the…
danio
  • 8,548
  • 6
  • 47
  • 55
16
votes
4 answers

Is it possible to require PyQt from setuptools setup.py?

I'm building a small app that uses PyQt and tought it'd be nice to declare that dependency in setup.py. However, according to this blog (first hit on google for pyqt setuptools) says it can't be done, and the last paragraph here doens't try to do…
Macke
  • 24,812
  • 7
  • 82
  • 118
16
votes
1 answer

Qt Designer how to change background

This is an repost. I am kind of new in QtDesigner and wanted to do something about the uglyness of just some buttons. All i have done yesterday was looking on the internet on how to change the background color of a screen in Qt Designer. How to…
That One
  • 581
  • 2
  • 6
  • 17
16
votes
2 answers

How to draw a proper grid on PyQt?

Let's consider this little snippet: import sys from PyQt5 import QtWidgets from PyQt5 import QtCore from PyQt5 import QtGui from PyQt5.QtWidgets import QMenu from PyQt5.QtGui import QKeySequence from PyQt5.QtCore import Qt from PyQt5.QtGui import…
BPL
  • 9,632
  • 9
  • 59
  • 117
16
votes
1 answer

PyQt: when are widgets with parents deleted?

Let's assume I want to create a dialog box, a child of my main program: from PyQt4 import QtGui, QtCore class WizardJournal(QtGui.QDialog): def __init__(self, parent): super(WizardJournal, self).__init__(parent) self.parent =…
JPFrancoia
  • 4,866
  • 10
  • 43
  • 73
16
votes
1 answer

SQL Update statement but using pyodbc

I am using a pyodbc driver to connect to a microsoft access table using SQL. Does anyone know how I go about replacing fields within this table?? I have though about deleting the row and then putting the row back but that would change the primary…
MrPython
  • 239
  • 1
  • 3
  • 12
16
votes
3 answers

Proper way to handle the close button in a main window PyQt, (Red "X")

First off, I am a complete newbie to PyQt. I have been trying to link a function to the Main Window's close button (the red x in the corner of the window) but I haven't been having any success. Right now, my code looks something like this: class…
sudobangbang
  • 1,406
  • 10
  • 32
  • 55