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
5
votes
1 answer

How to set a style sheet that only affects the parent in PyQT?

I'm trying to customize my UI. I don't know how to make a style sheet entry pertain to anything except the parent and ALL of the children. For example I run this line: self.lnchTab.setStyleSheet('QWidget { background-color: #1d1d1d ; color:…
Vii
  • 813
  • 3
  • 20
  • 32
5
votes
4 answers

How would you adblock using Python?

I'm slowly building a web browser in PyQt4 and like the speed i'm getting out of it. However, I want to combine easylist.txt with it. I believe adblock uses this to block http requests by the browser. How would you go about it using…
regomodo
  • 644
  • 3
  • 9
  • 18
5
votes
2 answers

Setting QIcon() pixmap from URL

how can i set Qicon from a url in PYQT , can you give me an example?
Anwar Mohamed
  • 625
  • 2
  • 13
  • 27
5
votes
1 answer

Twisted-PyQt4 segmentation faults

I'm using PyQt 4.9.1 on Ubuntu 12.04 (amd64) (tried with both python 2.6 and 2.7) to make a headless browser, but i'm getting: Program received signal SIGSEGV, Segmentation fault. Here is a simplified version of the program (still long a bit): # -*-…
andrean
  • 6,717
  • 2
  • 36
  • 43
5
votes
1 answer

How to drag and drop into a QTableWidget? (PyQT)

I'm struggling with getting drag&drop to work. I want to be able to drag&drop from a QPushButton into a cell of a QTableView. I've looked at a few tutorials online but seem to be stuck at the first step. The example below is changed from the amazing…
David Basalla
  • 2,996
  • 3
  • 18
  • 22
5
votes
2 answers

QKeyPress event in PyQt

I am having issues with my software. In my piano software if I keep pressing a key on the keyboard then it is making multiple repeated same tones of that particular key. But actually I need a single tone until the release of that particular key. I'm…
Hemanth Raveendran
  • 157
  • 2
  • 3
  • 8
4
votes
1 answer

Python-Disabling Action

I am developing python plugins for QGIS. I am listing all the database connections to menu bar, using following code: for key in sorted( self.actionsDb.iterkeys(), key=lambda x: x.lower() ): a = self.actionsDb[key] …
poonam
  • 748
  • 4
  • 19
  • 40
4
votes
2 answers

Python PyQt - QTableWidget, JSON, and emitSignal causing blank cells

I am using PyQt for a simple application that reads from a log file with JSON formatted strings, and outputs them nicely in a table. Everything is working as expected except when I try to emit a signal from a 'load' function. This signal is picked…
PenguinCoder
  • 4,335
  • 1
  • 26
  • 37
4
votes
1 answer

Adding a 'None' option to a QComboBox linked to a model

I have a QComboBox so the user can a network name from from a model column. I'm using code like this: self.networkSelectionCombo =…
Simon Hibbs
  • 5,941
  • 5
  • 26
  • 32
4
votes
1 answer

qrc file + ui file does not work

I have some problems with pyqt. I have to example files: login.ui login.qrc So, the login.ui, maked with the qt designer uses some resources of the qrc file. The qrc have some images for the buttons created in ui file. The qrc file is using an…
Andrey Luiz
  • 461
  • 9
  • 25
4
votes
1 answer

Linking QLineEdit's "enter" event to a slot?

I do have the following code: def init_widgets(self): mainLayout = QtGui.QGridLayout() self.label1 = QtGui.QLabel("Enter a song name: ") self.search_lineEdit = QtGui.QLineEdit() self.search_button =…
iTayb
  • 12,373
  • 24
  • 81
  • 135
4
votes
2 answers

Converting a QStringList (PyQt) into a normal python list

I want to take each element within a qstringlist and get the raw data from the list not whatever pyqt is storing it as. def find(self): self.foundFileList.setRowCount(0) fileName = self.inputFileName.currentText() path =…
DamianJ
  • 419
  • 2
  • 8
  • 18
4
votes
3 answers

Hover issue in PyQt

I want to do hover. I saw an example and then write a script which will be use as I made program. I am facing one problem that hover only occur if you put mouse on the left corner of button. I want that it will happen for all the button that if i…
Uahmed
  • 1,847
  • 5
  • 29
  • 45
4
votes
2 answers

How to build a QGroupBox with a button in the title?

I need for my app a groupbox with a button in title. Or something equivalent. Here is my usecase. The app reads a datastructure and build a propery panel out of it. Some properties can be added/removed via this property panel. If a property is a…
LBarret
  • 1,113
  • 10
  • 23
4
votes
1 answer

PyQt : How to set up a widget hidding an other widget if it's visible?

Let's say I created two QObject in my interface (ui). I would like to connect these two widgets and let them controling each other depending on their visual status. If one is hidden, the other one must be visible. And vice versa. Can you help me ?…
NicoCati
  • 527
  • 1
  • 8
  • 11