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

Python taskbar applet

I want to code up a panel that will be used both in Linux and Windows. Ideally it will be written in Python using PyQT. What I've found so far is the QSystemTrayIcon widget, and while that is quite useful, that's not quite what I'm looking for. That…
johannix
  • 29,188
  • 15
  • 39
  • 42
4
votes
1 answer

Scroll QTableWidget to specific column

I have a bunch of data in a QTableWidget and I would like to be able to scroll to a particular column. I'm currently using scrollToItem(self.item(0, col)). However, this hardcodes the row to 0. It causes problems if a user is looking at row 100…
durden2.0
  • 9,222
  • 9
  • 44
  • 57
4
votes
1 answer

PySide threading and http downloading

I've had soooo much trouble getting this code to work properly!!!! It runs fine when I debug it step by step, but when running normally it just crashes. Initially I was using a QThread to update the ImagePreview pixmap, but after a whole day of…
kellpossible
  • 663
  • 1
  • 8
  • 19
4
votes
1 answer

QDialog not opening from Main window (pyQt)

I'm trying to launch a dialog by clicking a button in the main window: Here's the (qtdesigner generated) code which I modified just to test it .. I've set the showDial function to show the dial when the button is clicked. But it doesn't work : from…
flak37
  • 885
  • 2
  • 10
  • 18
4
votes
2 answers

Error when compiling PyQt4 with Pyinstaller

In the past, I've used pycompiler (or 'pyinstaller') to compile my programs that use the PyQt4 framework to executable code, simply because py2exe. I have switched computers recently and have not yet managed to compile my PyQt4 programs on it! In…
Anti Earth
  • 4,671
  • 13
  • 52
  • 83
4
votes
2 answers

Add a Maximize button to a PyQt4 dialog and keep the dialog centered to the parent window

I have a dialog with a big textbox. I want the user to be able to maximize the dialog. I already tried the following options (XML_Editor is a QDialog instance): XML_Editor.setWindowFlags(QtCore.Qt.Window or QtCore.Qt.WindowMaximizeButtonHint) --…
krlmlr
  • 25,056
  • 14
  • 120
  • 217
4
votes
2 answers

PyQt - how to read documentation

I need some advise about how to read PyQt's documentation. Because on my own I can hardly figure anything out. I'm a programming newbie so sorry if my question is confusing. I'll try to explain the best I can :) This is an example of where I got…
Panupat
  • 452
  • 6
  • 21
4
votes
2 answers

Subclassing QLabel to show native 'Mouse Hover Button indicator'

I have a QLabel with a 'StyledPanel, raised' frame. It is clickable, by subclassing QLabel; class InteractiveLabel(QtGui.QLabel): def __init__(self, parent): QtGui.QLabel.__init__(self, parent) def mouseReleaseEvent(self, event): …
Anti Earth
  • 4,671
  • 13
  • 52
  • 83
4
votes
1 answer

Create QTableWidget with 2 or more header rows

I'd like to have a QTableWidget that has 2 'header' rows. Essentially I'd like to have the top 2 rows of the table not scroll vertically. For example: Header 1 | Header 2 __________________ Header 3 | Header 4 __________________ Data |…
durden2.0
  • 9,222
  • 9
  • 44
  • 57
4
votes
1 answer

PyQt - How to turn on/off spellchecking

I'm using the following as a basis for my editor's spellchecker. I want to make an auto-spellcheck button, which when pressed will make the spellchecker work, and when not pressed, the spellchecker should not highlight or suggest anything. You know…
linuxoid
  • 1,415
  • 3
  • 14
  • 32
4
votes
2 answers

Embed matplotlib widget in multiple places

I have a matplotlib graph which I want repeated in two separate windows, under PyQt4. I've tried adding the widget to the layout of both, but then the widget vanishes from the first one. Is there any way to do this except creating two identical…
Sudarshan S
  • 1,235
  • 2
  • 16
  • 25
4
votes
1 answer

Clear selection when clicking on blank area of Item View

I made a tree structure with QTreeWidget, and it works well. But I have a problem with that. Commonly, with a tree structure, if I want to deselect all, I click on a blank area of the tree-widget. But QTreeWidget does not seem to support that (or I…
Hyun-geun Kim
  • 919
  • 3
  • 22
  • 37
4
votes
2 answers

How to create a new window button PySide/PyQt?

I'm having problems with a "New Window" function in PyQt4/PySide with Python 2.7. I connected a initNewWindow() function, to create a new window, to an action and put it in a menu bar. Once a common function in desktop software. Instead of giving me…
Christopher
  • 639
  • 1
  • 6
  • 14
4
votes
1 answer

How do I stop the QTreeWidget from moving the scroll position?

I have a QTreeWidget with a bunch of QTreeWidgetItems. Each item has a couple columns. When one of the columns is wider than the width of the widget, there will be a scroll bar at the bottom. When I click on a QTreeWidgetItem inside the column that…
Di Zou
  • 4,469
  • 13
  • 59
  • 88
4
votes
1 answer

PyQt get date from the user

I built simple widget in Qt Designer with a button and a QDateEdit. The user will enter the date into the QDateEdit and then when he presses the button, the date will be saved to a variable. How can I do it?
pol
  • 315
  • 2
  • 3
  • 7