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

Unable to install PyQt5 with pip

Im running into a problem installing PyQt5 with pip: pip install pyqt5 DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew…
Kojuru
  • 41
  • 1
  • 3
4
votes
1 answer

Fail to load image into QGraphicsView (float division by zero). Recognizes the rect, but won't set the scene

I have a basic image viewer (mostly just trying to learn the quirks of QGraphicsView rather than labels) that I'm trying to allow some basic zoom and pan functionality. It loads a directory of images the user can click through, but fails to load…
geodranic
  • 145
  • 9
4
votes
1 answer

PyQt/PySide QMainWindow - switching between views

Hello PyQt/PySide experts, I am a newbie to both PyQt/PySide and desktop application development (I'm a web developer). I have a question about how you should navigate among different views in a PyQt/PySide application. Suppose my app has views…
Sacki
  • 137
  • 3
  • 10
4
votes
1 answer

QPropertyAnimation doesn't work with a child widget

The below code doesn't animate the button as expected. But it works if the button is stand alone and stops working when it is a child widget. What am I doing wrong here? I'm trying this on Ubuntu. class TestWindow(QtGui.QWidget): def…
Anoop
  • 1,307
  • 1
  • 14
  • 27
4
votes
1 answer

PyQt5 QLabel hyperlink tooltip/hovertext

Why this is not working or any simple alternative to this: label= QLabel("Name: ABC | Contact:
4
votes
1 answer

PyQT QPushButton.setMenu? How to make it work?

im just a beginner in PyQT. and im not sure if my thread title is the correct thing to put for my problem. im having a problem creating a popmenu on a Qpushbutton. based on the doc of QT docs i need to make a QPushButton.setMenu (self, QMenu…
Katherina
  • 2,153
  • 7
  • 26
  • 34
4
votes
1 answer

How to select another type of font with QFont?

I am trying to assign different types of text fonts to my application with PyQt5, but I don't know how to assign a different one to the standard one, for example in my application I could only assign it 'Roboto', but if I want to change to…
Leo Odriozola
  • 43
  • 1
  • 3
4
votes
1 answer

PyQt: How to use :hover in button-stylesheet

I know how to use QPushButton:hover in the stylesheet for my QMainWindow(). However for only one single button I want to have a different :hover result. Is there a way to use the :hover-function while setting the stylesheet for the specific…
monaghans_creed
  • 123
  • 1
  • 2
  • 10
4
votes
2 answers

What's the difference between QSizePolicy.Minimum and QSizePolicy.Preferred?

I read that "preferred policy is very flexible policy and the size of widget can be smaller and larger than sizeHint()." But while I increased or decreased the size of windows, I couldn't find any differences between them. < QSizePolicy.Minimum…
fringetos
  • 73
  • 1
  • 5
4
votes
1 answer

Install PyQt for Python3.9 on a computer without internet connection

I'm trying to install PyQt on a windows computer without internet connection. The computer seems to have a very recent version of Python (Python 3.9.2) so the older.exe files available online don't seem to be compatible. I downloaded the whl file…
yem
  • 529
  • 1
  • 6
  • 20
4
votes
5 answers

Python dynamic function generation

I am using PyQt and want to create a menu based on a list of strings. The problem is that when I want to call 'addAction', it requires a call-back function (for each string) that does not take any arguments. For simple menus, this would be fine:…
Ciaran
  • 553
  • 5
  • 14
4
votes
1 answer

PyQt: Qt.Popup widget sometimes loses focus without closing, becomes unclosable

I'm writing a very small application with PyQt. All of my testing has been on Ubuntu/gnome so far. I want a single "Popup" style window, with no taskbar/panel entry, that will close itself (and the application) the moment it loses focus. The…
Trip Volpe
  • 210
  • 2
  • 8
4
votes
1 answer

What does retranslateUi do in PyQT

When running pyuic5 command and generating a python file from QT designer UI file there is a retranslateUi function. def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate …
Lightsout
  • 3,454
  • 2
  • 36
  • 65
4
votes
8 answers

How can resources be provided in PyQt6 (which has no pyrcc)?

The documentation for PyQt6 states that Support for Qt’s resource system has been removed (i.e. there is no pyrcc6). In light of this, how should one provide resources for a PyQt6 application?
biqqles
  • 303
  • 3
  • 10
4
votes
1 answer

Render Markdown with PyQt5

How can I render a markdown file in my PyQt5 application? Here I read that I should use a QWebEngineView instead of a QTextEdit because the QTextEdit can't render external images. In a comment someone references this example. It is however a…
Legatio
  • 259
  • 3
  • 9