Questions tagged [pyqt5]

Qt 5 bindings for Python programming. This allows programmer to make Qt 5 graphical user interfaces using Python syntax.

Qt 5 bindings for Python programming language. This allows programmer to make Qt 5 graphical user interfaces using Python syntax.

14659 questions
35
votes
5 answers

How to build multiple .py files into a single executable file using pyinstaller?

I have made a small PyQt application containing 5-6 .py files. Now I want to build and compile them into a single main file, meaning it has to operate from one main window exe. My .py files are connected with each other successfully. I have used…
Nabeel Ayub
  • 1,060
  • 3
  • 15
  • 35
33
votes
3 answers

Proper way to quit/exit a PyQt program

I have a script which has a login screen and if the cancel button is pressed, I want to exit the application altogether. I have tried 3 ways: sys.exit() QApplication.quit() QCoreApplication.instance().quit() Only number 1 works. The other two…
Dkellygb
  • 866
  • 2
  • 8
  • 24
32
votes
22 answers

How to install PyQt5 on Windows?

When I try installing the PyQt5 on Windows using the command python configure.py I get this error: Error: Make sure you have a working Qt qmake on your PATH. I got the pyQt5 from PyQt5 Download. How can I install PyQt5? Update: I installed Qt…
Victor Lellis
  • 1,304
  • 1
  • 14
  • 25
30
votes
3 answers

How to add items to a QComboBox in PyQt/PySide

I need some help adding some items to a QComboBox. So I have two comboboxes, and one populates the other depending on the item selected. My question is that, using additem for new items, it works, but if I choose another option for the combobox, it…
IordanouGiannis
  • 4,149
  • 16
  • 65
  • 99
30
votes
1 answer

Plotting matplotlib figure inside QWidget using Qt Designer form and PyQt5

I don't understand the best way to link a matplotlib figure to a form created from Qt Designer. I have a form I created in QtDesigner and then compiled to python through pyuic5. My main program is: import app_framework as af import matplotlib from…
launchpadmcquack
  • 1,021
  • 1
  • 12
  • 19
30
votes
4 answers

How to install PyQt5 in Python 3 (Ubuntu 14.04)

I need to port some code that's Python2+PyQt4 to Python3+PyQt5. I started installing pip3 sudo apt-get install python3-pip Works great. Tried sudo pip3 install PyQt5 Downloading/unpacking PyQt5 Could not find any downloads that satisfy the…
eri0o
  • 2,285
  • 4
  • 27
  • 43
29
votes
3 answers

How can I check if a keyboard modifier is pressed (Shift, Ctrl, or Alt)?

I am building a UI with Qt Creator and I want buttons to perform different actions with different modifiers. So I thought I could call functions with dynamic string properties that would perform the action depending on the modifier. Is there a…
user1087058
  • 349
  • 1
  • 3
  • 5
29
votes
7 answers

How can I change the cursor shape with PyQt?

I have a simple application that runs a process that can last for several minutes before completing. I am trying to provide an indication to the user that it is processing the request - such as changing the cursor to an hourglass. But I cannot…
TimothyAWiseman
  • 14,385
  • 12
  • 40
  • 47
29
votes
8 answers

No name 'QApplication' in module 'PyQt5.QtWidgets' error in Pylint

Running into this issue in VS Code while trying to learn PyQt5, "No name 'QApplication' in module 'PyQt5.QtWidgets'", "No name 'QWidget' in module 'PyQt5.QtWidgets'"". I'm not sure if this is a pylint issue or something else. I've confirmed PyQt5 is…
wolfeyes90
  • 1,022
  • 1
  • 8
  • 15
29
votes
2 answers

Why do I need to decorate connected slots with pyqtSlot?

I'm using pyqt5, and I have several methods connected using code similar to the following: self.progress.canceled.connect(self.cancel) Where, for example, self.cancel is: def cancel(self): self.timer.stop() This code seems to work cleanly in…
NirIzr
  • 3,131
  • 2
  • 30
  • 49
29
votes
5 answers

Cannot import QtWebKitWidgets in PyQt5

I've recently upgraded PyQt5 from 5.5.1 to 5.6.0 using the Windows 32-bit installer here: https://www.riverbankcomputing.com/software/pyqt/download5. I've also upgraded my python from 3.4 to 3.5. When I run my old code (which used to work) with the…
Jibbity jobby
  • 1,255
  • 2
  • 12
  • 26
29
votes
2 answers

PyQt5 cannot import name 'QApplication'

I am trying convert my code from PyQt4 to PyQt5 but I am getting errors. from PyQt5.QtGui import QApplication, QPixmap desktop = QApplication.desktop() QPixmap.grabWindow(desktop.screen().winId()).save("screen.png", "PNG") 3.4.3…
Arthur Yakovlev
  • 8,933
  • 8
  • 32
  • 48
29
votes
2 answers

Multiple inheritance metaclass conflict

I need a double inheritance for a class. I tried several syntaxes but I don't understand the concept of metaclass. from PyQt5.QtGui import QStandardItem from configparser import ConfigParser class FinalClass(ConfigParser, QStandardItem): def…
Mauricio
  • 670
  • 1
  • 8
  • 23
28
votes
13 answers

How can I run pyqt5 on my Mac with M1chip (ppc64el architecture)?

Now. When I run it. The error comes ImportError: dlopen(/Users/v/Library/Python/3.8/lib/python/site-packages/PyQt5/QtWidgets.abi3.so, 2): no suitable image found. Did…
vihanchou
  • 380
  • 1
  • 3
  • 6
28
votes
2 answers

Cannot load backend 'Qt5Agg' which requires the 'qt5' interactive framework, as 'headless' is currently running

I am trying to use Qt as matplotlib backend. i have checked it both on kaggle and google colab, but problem is same. When i write %matplotlib qt5 i got following error ImportError: Cannot load backend 'Qt5Agg' which requires the 'qt5' interactive…
Talha Anwar
  • 2,699
  • 4
  • 23
  • 62