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

Program stops responding after clicking a button

I'm trying to make my first ever program, a port scanner that shows all the open ports on a remote server, I've gotten it to work in CLI (thanks to the internet) but decided to make a GUI (Qt5) for it. I want textbox2 to output all the open ports…
Damm
  • 43
  • 3
4
votes
1 answer

How to convert QLabel to QTableWidgetItem to put into QTableWidget

I want to add an icon to my QTableWidget. However, the icon being added is pretty small, so I try to find a way to resize the icon I have tried using setSizeHint(), but it didn't work. So I thought of creating a pixmap and set the pixmap in QLabel,…
James
  • 57
  • 3
4
votes
1 answer

PyQtgraph - Draw ROI by mouse click & drag

I would like to draw ROI's by click and drag events in the PlotWidget. The issue is that several click interactions are already reserved for the PlotWidget, second it is hard to tell the right position of the mouse in the PlotWidget - especially…
Synaps
  • 323
  • 5
  • 14
4
votes
1 answer

Why are my labels stacking on top of each other inside my QHBoxLayout?

Simply enough, I want to add two labels inside an horizontal box layout using Python's PYQT5. When I execute this code, the two labels appear on top of each other, even though adding them to a QHBoxLayout should position them from left to right. How…
4
votes
2 answers

Moving a frameless QDialog with a MouseMoveEvent

So I have a frameless QDialog that I want to be able to move around simply by clicking and dragging it. Given the code below, dragging the dialog always snaps the very top-left (0,0) of the dialog to the mouse. How might I circumvent this, or…
Cryptite
  • 1,426
  • 2
  • 28
  • 50
4
votes
1 answer

PyQtGraph: prevent QScrollArea scrolling when panning plot

In PyQtGraph you can zoom into the plots with the scroll wheel. However, when embedding PyQtGraph inside a QScrollArea, scrolling both zooms into the hovered plot AND scrolls the QScrollArea. Minimal reproducable code: from PyQt5.QtWidgets import…
kangalio
  • 652
  • 8
  • 16
4
votes
3 answers

Can't Kill PyQT Window after closing it. Which requires me to restart the kernal

I guess that I am not closing my PyQT5 Window correctly. I am using spyder (3.3.5) which I have installed with anaconda, to program a pyqt5 program. I am using qt creator to design my ui file, which I load using the loadUi function in pyqt package.…
mashtock
  • 400
  • 4
  • 21
4
votes
1 answer

How to convert a QPixmap's image into a bytes

I want to take an image's data from a QLabel and then store it into a PostgreSQL Database, but I cannot store it as QPixmap, first I need to convert it into a bytes. That's what I want to know. I've read part of the pyqt5's doc, specially the…
4
votes
2 answers

whats the advantage of QSettings over just using a dict?

QSettings seems like a great thing in C++, it's essentially a flexible hash table where the key is a string and the value is a QVariant, so it can be quite a few types. However, in Python we already have this, its a dictionary. So I ask, what…
Kevin S
  • 930
  • 10
  • 19
4
votes
1 answer

Add Icon to Tab (QTabWidget)?

I'm working with a QTabWidget with three Tabs. One of the tab is about Information/Help. So I want to use a picture of a Question Mark (.png) instead of the Text "help". Is this Possible? I'm working with Python/PyQt and I can only find solutions…
NewPython19
  • 75
  • 1
  • 6
4
votes
3 answers

Images not showing when running a frozen pyqt app on another computer

I have a PyQt4 program that I froze using cx_freeze. The problem I am having is when I make a QGraphicsPixmapItem, which it is getting its' pixmap made from a SVG file, the Item gets made no problem, but the Pixmap doesn't load so there is no image…
Brock S.
  • 424
  • 2
  • 7
  • 13
4
votes
1 answer

Setup signal and slot before moving Worker object to QThread in pyqt

In Qt/PyQt, I used to make threading using a Worker class and a QThread. self.worker = Worker() self.thread = QThread() worker.moveToThread(thread) setup_signal_slot_with_main_object() // start thread.start() I must place…
shang12
  • 423
  • 5
  • 18
4
votes
1 answer

Show an OpenCV image with PyQt5

I'm learning to use pyqt5 and qt designer and I am so confused. My goal is show a picture when I click a push button because in a future I want to combine all of this with opencv. Now I have a window with a push button and an image (it is a…
mmr689
  • 91
  • 1
  • 1
  • 6
4
votes
1 answer

How to make a multi-page application in PyQt5?

I want to make a simple GUI-App in PyQt. When a button gets clicked, it should take you to the next page. It's like these installations dialoges you know when installing a program. I tried to open a new window at the exact same position like the…
Adrian
  • 157
  • 1
  • 7
4
votes
1 answer

Connect QRunnable to a function/method when finished

QThread has a finished signal, and I am able to do something when thread is finished (connect to a method/function), however I would like to do this with QRunnable as well. Is there a way to connect the QRunnable thread to a method/function when it…
Drees
  • 688
  • 1
  • 6
  • 21