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
15
votes
3 answers

How to display a message box on PyQT4?

I'd like a MessageBox to display when I click a button on my simple PyQT application. How can I declare two textboxes and have a MessageBox display with the text from both textboxes? Here's my code far: import sys from PyQt4 import QtGui,…
delete
15
votes
3 answers

Pyqt5 qthread + signal not working + gui freeze

I am trying to make a mailbox checker with imap lib, it work pretty fine with python, queue and multithread without gui. But when I try to put a gui, every fonction i made, make the gui freeze until finish . I tried many thing from various doc(add…
kenjii himura
  • 193
  • 1
  • 1
  • 10
15
votes
1 answer

PyQt: Change GUI Layout after button is clicked

Okay, I am jumping from Tkinter to PyQt, because PyQt is just so much more advanced, and nicer to work with. BUT! I am having some troubles here. I am trying to change the GUI layout after I press one of my buttons on the main screen. I press the…
Tyrell
  • 896
  • 7
  • 15
  • 26
15
votes
6 answers

PIL Image to QPixmap conversion issue

I've been struggling with this challenge for the best of today, I've managed to get a good point using previous posts and other resources. I'm trying to convert a PIL.Image to a QPixmap so that I can display using a QgraphicsScene on my PyQT GUI.…
Pys3nberg
  • 181
  • 1
  • 2
  • 9
15
votes
1 answer

Communication between threads in PySide

I have a thread which produces some data (a python list) and which shall be available for a widget that will read and display the data in the main thread. Actually, I'm using QMutex to provide access to the data, in this way: class Thread(QThread): …
AkiRoss
  • 11,745
  • 6
  • 59
  • 86
15
votes
1 answer

How to select QTableView row with one click

When one of the QTableView's QModelIndex is clicked I want to select an entire row of the same-row-indexes. To accomplish this I connect QTableView's clicked signal to a custom viewClicked() method which receives the clicked QModelIndex…
alphanumeric
  • 17,967
  • 64
  • 244
  • 392
15
votes
9 answers

Is it possible to deselect in a QTreeView by clicking off an item?

I'd like to be able to deselect items in my QTreeView by clicking in a part of the QTreeView with no items in, but I can't seem to find anyway of doing this. I'd intercept a click that's not on an item, but the QTreeView doesn't have a clicked…
Skilldrick
  • 69,215
  • 34
  • 177
  • 229
15
votes
1 answer

How to convert requests.cookiejar to qnetworkcookiejar?

Is there a simple way to convert a cookiejar from the Python 3 requests library to a qnetworkcookiejar? I convert the cookiejar from the requests library into a dictionary and then in a qnetworkcookiejar. Some cookies are there in multiple versions…
Pumba
  • 181
  • 5
15
votes
6 answers

how code a Image button in PyQt?

Im trying to do simple audio player, but I want use a image(icon) as a pushbutton.
Alquimista
  • 862
  • 2
  • 10
  • 24
15
votes
2 answers

How to Redirect Logger Output into PyQt Text Widget

A code posted on Redirecting Output in PyQt does two good things at once: it takes advantage of logging module to nicely format messages and it redirects standard stdout and stderr in to QT QTextBrowser widget. But I would like QTextBrowser to…
alphanumeric
  • 17,967
  • 64
  • 244
  • 392
15
votes
2 answers

How to install SIP and PyQt on a virtual environment?

I am new to virtualenv. I want to install spyder, which require PyQt4, which requires SIP. pip doesn't work, so I downloaded SIP, and I did the following commands: python configure.py make make install But I received this error: make[1]: entrant…
Pierpaolo
  • 1,721
  • 4
  • 20
  • 34
15
votes
2 answers

How to find an object by name in pyqt?

I have a list of dictionaries: globalParams = [{'attr':'enabled','ctrl':'checkBoxEnabled','type':'checkBox'}, {'attr':'colorMode','ctrl':'comboBoxColorMode','type':'comboBox'}] 'ctrl' - name of the control in the Qt window.…
Massimo
  • 836
  • 3
  • 17
  • 38
15
votes
3 answers

Pyqt how to get a widget's dimensions

I am currently developing an application in which i cannot use modal windows (due to some application constraints). However, in some cases i would like to simulate a popup window. To do so i dynamically create a widget that has the centralwidget as…
ibi0tux
  • 2,481
  • 4
  • 28
  • 49
15
votes
3 answers

How can I enable / disable QTableWidget's horizontal / vertical header?

If I set the horizontalHeaderVisible or verticalHeaderVisible attribute to false in Qt Designer, this works fine. But how can I enable / disable headers in my code? I've been trying something like this: self.ui.tblContents.horizontalHeaderVisible =…
eonhelm
  • 229
  • 1
  • 4
  • 8
15
votes
2 answers

Just installed QtOpenGL but cannot import it (from Python)

I just installed it with apt-get on debian linux with apt-get install libqt4-opengl the rest of PyQt4 is available, but I cant get to this new module. from PyQt4 import QtOpenGL raises ImportError. any idea what to do?
Nathan
  • 6,095
  • 10
  • 45
  • 54