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

TypeError: start() argument after * must be an iterable, not int

I want run some timer in thread,but it display ERRORTypeError: start() argument after * must be an iterable, not int,How can I fix it? while 1: try: _thread.start_new_thread(self.timer0.start,100) …
kevin880701
  • 85
  • 1
  • 2
  • 10
4
votes
1 answer

No module named 'dbus.mainloop.pyqt5' even if all dependencies seem to be installed

I am trying to use DBUS as the main loop of PyQt5. System-wide I installed, system-wide (with apt, LinuxMint 19, amd64), the following dependencies: python3-pyqt5 Version: 5.10.1+dfsg-1ubuntu2 python3-dbus Version:…
Ehvince
  • 17,274
  • 7
  • 58
  • 79
4
votes
2 answers

How display a QPropertyAnimation() on top of the QScrollArea()?

1. Intro I'm working in Python 3.7 on Windows 10 and use PyQt5 for the GUI. In my application, I got a QScrollArea() with an array of buttons inside. When clicked, a button has to move outside the area. I use a QPropertyAnimation() to show the…
K.Mulier
  • 8,069
  • 15
  • 79
  • 141
4
votes
1 answer

How to change the icon of an action in the toolbar at runtime?

I want to change QAction's icon in Toolbar when it is clicked. I have seen the same question in C++, but it's hard to me to understand other languages. (On Qt, how to change the icon of an action in the toolbar at runtime?) import sys from…
Gunter-R
  • 85
  • 1
  • 5
4
votes
1 answer

Complex context-menu submenu

I have a Qt5 application mainly driven by context menu. Right now I have the standard structure with menu(s), submenu(s) and actions. I would like to add, in place of a submenu, a small dialog with a few input widgets, something like this: Is…
ZioByte
  • 2,690
  • 1
  • 32
  • 68
4
votes
1 answer

When I try to run speech recognition in pyqt5 program is crashed

When I try to run speech recognition in pyqt5 program is crashed. Sr's code is at the another script file. I import it to pyqt5 script. I connected button with sr function. When I press the button sr work but crashs both. PyQt5 Code: import sys from…
Laccazet
  • 143
  • 1
  • 7
4
votes
1 answer

How to change default position of toolbar?

I'm using PyQt5, QMainWindow and I want to change default position of toolbar to the right. How can I do it? User can carry toolbar to the edges of the window using mouse, but how can I do it using program? def initUI(self): self.toolbar =…
Gunter-R
  • 85
  • 1
  • 5
4
votes
1 answer

How to get the widget that has the focus

As in the title, I need to get child's name. However, the template is from Qt Creator and all objects are created in the program. I don't know how to subclass them (as I shoudn't change generated file), so all objects after calling would return…
Plajerity
  • 161
  • 2
  • 11
4
votes
2 answers

How can I get more input text in PyQt5 InputDialog?

I want get more than one input text from user in PyQt5.QtWidgets QInputDialog ... in this code I can just get one input text box and I want get more input text box when I was clicked the button. See the picture to more information ... from…
Jack Parten
  • 59
  • 2
  • 11
4
votes
1 answer

How to download csv file with QWebEngineView and QUrl

I'm building a program which uses QWebEngineView and QUrl to display a website in my PyQt5 app (running on Windows 10). However, I now want to be able to download a CSV file from the same website, but being a noob I can't seem to figure out…
codeacker
  • 85
  • 1
  • 11
4
votes
0 answers

No Module named QtMultimedia

Trying to play audio in a qt gui I've tried basically every suggestion on Google pertaining to playing audio with pyqt (pyside, pygame, QtMultimedia). It seems pretty straight forward using QSound, but it doesn't work for me for some reason from…
4
votes
1 answer

How to resize or scale a QIcon?

I'm attempting to scale up a QIcon, but its not working. class Example(QMainWindow): def __init__(self): super().__init__() self.initUI() def initUI(self): exitIcon = QPixmap('./icons/outline-exit_to_app-24px.svg') …
Enrico Tuvera Jr
  • 2,739
  • 6
  • 35
  • 51
4
votes
2 answers

Sending Data from Child to Parent Window in PyQt5

What I can't do I'm not able to send data back from a child to a parent window. What I have I've got a complex GUI with several windows sendíng data to child windows. Each window represents a unique Python-script in the same directory. There was no…
alex_555
  • 1,092
  • 1
  • 14
  • 27
4
votes
1 answer

What is Dummy in threading.current_thread()?

I am trying to understand the code in this How to use QThread correctly in pyqt with moveToThread()? The portion that has: mainwin.__init__ : MainThread, 140221684574016, GenericWorker.__init__ : MainThread,…
4
votes
0 answers

How to show the live preview from picamera in a GUI Window made by PyQt5?

I am designing a GUI to capture an image from picamera, I am using PyQt5 to develop the GUI. I used camera.start_preview() function to see the live preview. After that I used a button named "Take" to capture the image and after capturing the image I…