Skip to main content

Questions tagged [pyqt5]

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

Filter by
Sorted by
Tagged with
70 votes
14 answers
72k views

AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel' for PyQt5 5.15.0

A program I am trying to install requires the installation of PyQt5 5.15.0 , which gives me this error. The odd thing is that the installation works fine for the latest version of PyQt5 (5.15.2), but ...
thecrispywisp's user avatar
67 votes
3 answers
60k views

Is there a tutorial specifically for PyQt5? [closed]

I am looking for a PyQt5 tutorial. It is rather complicated to start GUI development with Python for the first time without a tutorial. I only found some PyQt4 tutorials so far, and since something ...
WeGi's user avatar
  • 1,906
65 votes
6 answers
145k views

Python 3.7.0 No module named 'PyQt5.QtWebEngineWidgets'

I have Python 3.7.0 and I installed PyQt5 with this command: pip install PyQt5 I have returned this error: main.py", line 4, in <module> from PyQt5.QtWebEngineWidgets import * ...
michele's user avatar
  • 26.5k
63 votes
3 answers
38k views

Should I use `app.exec()` or `app.exec_()` in my PyQt application?

I use Python 3 and PyQt5. Here's my test PyQt5 program, focus on the last 2 lines: from PyQt5.QtCore import * from PyQt5.QtWidgets import * import sys class window(QWidget): def __init__(self,parent=...
socket's user avatar
  • 1,203
62 votes
21 answers
215k views

PyQt5: How to install/run Qt Designer

Feeling really stupid, right now, but the title says it all: How do you start the QtDesigner? I've installed PyQt5 via pip and I believe to have identified the directory it's been installed in as C:...
User1291's user avatar
  • 8,042
58 votes
4 answers
250k views

How to get text in QlineEdit when QpushButton is pressed in a string?

I am trying to implement a function. My code is given below. I want to get the text in lineedit with objectname 'host' in a string say 'shost' when the user clicks the pushbutton with name 'connect'. ...
esafwan's user avatar
  • 17.7k
48 votes
8 answers
98k views

Dark theme for Qt widgets?

Background I'm building a PyQt5 application, that I'd like to have a dark theme for. Previously I've worked with Android development where there was a dark theme that I could set for a whole ...
sunyata's user avatar
  • 2,081
48 votes
9 answers
237k views

ImportError: No module named PytQt5

following are my python, qt and sip versions root@thura:~# python -V Python 2.7.3 root@thura:~# qmake --version QMake version 3.0 Using Qt version 5.0.2 in /usr/lib/i386-linux-gnu root@thura:~# sip -...
Thu Ra's user avatar
  • 2,053
46 votes
11 answers
99k views

Process finished with exit code -1073741819 (0xC0000005) Pycharm

I'm completly stuck on this. I keep getting error message Process finished with exit code -1073741819 (0xC0000005) I'm using pycharm with pyqt5.6 and qt5.6.2 and the problem started when I ...
A Rob4's user avatar
  • 1,438
44 votes
3 answers
163k views

PyQt proper use of emit() and pyqtSignal()

I am reading through some documentation on PyQt5 to come up with a simple signal-slot mechanism. I have come to a halt due to a design consideration. Consider the following code: import sys from ...
Max's user avatar
  • 2,122
43 votes
1 answer
98k views

PyQt5 failing import of QtGui

I've just moved from PyQt4 to 5 and I'm having an issue with QtGui. I installed using the 32bit windows installer, not my own build. when I do: from PyQt5 import QtGui I get class MainWindow(...
Faller's user avatar
  • 1,658
41 votes
30 answers
136k views

DLL load failed when importing PyQt5

I have installed PyQt5 on windows platform and and getting an importError: DLL load failed. I have installed pyqt5 using the command pip3 install pyqt5 Successfully installed pyqt5-5.8.1 My ...
gdRow's user avatar
  • 517
40 votes
5 answers
106k views

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 ...
Nabeel Ayub's user avatar
  • 1,210
39 votes
1 answer
76k views

How to set QComboBox to item from item's text in PyQt/PySide

Is it possible to set QComboBox to an item knowing only an item's text value? I am trying to avoid looping through for i in range(myCombobox.count()) just to find an item's index so it could be used ...
alphanumeric's user avatar
  • 18.8k
37 votes
8 answers
49k views

Install PyQt5 5.14.1 on Linux

pip3 install PyQt5 Collecting PyQt5 Using cached https://files.pythonhosted.org/packages/3a/fb/eb51731f2dc7c22d8e1a63ba88fb702727b324c6352183a32f27f73b8116/PyQt5-5.14.1.tar.gz Complete output ...
ooo's user avatar
  • 542
37 votes
4 answers
23k views

This application failed to start because it could not find or load the Qt platform plugin "cocoa"

I think I did everything I could in the last 20 hours, but nothing seems to work. My app is running and working -- just as it should -- the only problem I have is that I cannot create a .app bundle ...
Peter Varo's user avatar
36 votes
4 answers
92k views

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(...
Dkellygb's user avatar
  • 896
33 votes
8 answers
31k views

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 ...
wolfeyes90's user avatar
  • 1,092
32 votes
22 answers
249k views

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. ...
Victor Lellis's user avatar
32 votes
3 answers
85k views

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, ...
IordanouGiannis's user avatar
32 votes
2 answers
24k views

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 ...
Talha Anwar's user avatar
  • 2,883
31 votes
5 answers
102k views

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. ...
Jibbity jobby's user avatar
31 votes
2 answers
26k views

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 ...
Mauricio's user avatar
  • 702
31 votes
1 answer
51k views

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: ...
launchpadmcquack's user avatar
30 votes
4 answers
112k views

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 ...
eri0o's user avatar
  • 2,413
30 votes
2 answers
53k views

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())....
Arthur Yakovlev's user avatar
29 votes
8 answers
40k views

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 ...
TimothyAWiseman's user avatar
29 votes
3 answers
40k views

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 ...
user1087058's user avatar
29 votes
2 answers
8k views

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....
NirIzr's user avatar
  • 3,330
28 votes
13 answers
46k views

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 find: /Users/v/Library/Python/3....
vihanchou's user avatar
  • 380
26 votes
7 answers
80k views

Python PyQt5: How to show an error message with PyQt5

In normal Python (3.x) we always use showerror() from the tkinter module to display an error message but what should I do in PyQt5 to display exactly the same message type as well?
Ramón Wilhelm's user avatar
26 votes
9 answers
39k views

Pip Install stuck on "Preparing Wheel metadata..." when trying to install PyQT5

I'm trying to install PyQT5 on my Raspberry Pi and used the command sudo pip3 install pyqt5. But it has been stuck on that for over an hour nowand I'm starting to get frustrated, since it still moves, ...
user avatar
26 votes
3 answers
69k views

PyQt showing video stream from opencv

Try to link PyQt and Opencv video feed, can't understand how to apply while loop for continuously streaming video. It just take a still picture.Please can anyone help to solve the problem. PtQt=5 ...
Taimur Islam's user avatar
26 votes
5 answers
96k views

PyQt5: Center align a label

This should be really simple but I just can't find an answer for this. I've tried this PyQt4 code: label.setAlignment(Qt.AlignCenter) But that does not work.
Lachlan's user avatar
  • 1,264
26 votes
4 answers
38k views

How to set current tab of QTabWidget by name?

PyQt5's QTabWidget has a method setCurrentIndex that you can use to get a particular tab to become the active tab. I can't seem to find any way to index by tab name though (which I set in Qt Designer)....
aoh's user avatar
  • 1,140
24 votes
5 answers
69k views

How to set a window icon with PyQt5?

from PyQt5 import QtWidgets, QtGui from PyQt5.QtWidgets import * from PyQt5.QtCore import * class Application(QMainWindow): def __init__(self): super(Application, self).__init__() ...
HumanAfterAll's user avatar
23 votes
3 answers
48k views

How to display a Pandas data frame with PyQt5/PySide2

I have a problem with the line below self.tableView.set??????????(df) that supposed to display the data frame in PyQt5. I put ??? there where I am missing the code I need. def btn_clk(self): ...
Joe T. Boka's user avatar
  • 6,581
23 votes
3 answers
44k views

How to install PyQt5 on Windows for Python 2?

I am porting a Python 2 app which uses PyQt5 from Linux to Windows. Question: How do I install PyQt5 on Windows? What I have tried: pip install PyQt5 fails with: Downloading/unpacking PyQt5 ...
Babken Vardanyan's user avatar
23 votes
7 answers
36k views

Error when using pyinstaller: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff

I have an issue when i compile a PyQt code with pyinstaller. I use this line to compile: c:\Anaconda3\Scripts\pyinstaller.exe -y -F --distpath="." MyQt.py then I get this error message: File ...
ymmx's user avatar
  • 4,830
22 votes
1 answer
63k views

Get text from qtextedit and assign it to a variable

When I try to get the text from the qtextedit created with PyQt5 Designer I get an error or "Python stop working" and the script stop automatically. I've tried multiple solutions but nothing works. I ...
Abunis's user avatar
  • 227
22 votes
2 answers
34k views

ImportError: cannot import name 'QStringList' in PyQt5

I am using PyQt5 but can't import QStringList. I know that QStringList used to be in the module QtCore in PyQt4. So I try importing the class using from PyQt5.QtCore import QStringList but it shows ...
Sнаđошƒаӽ's user avatar
22 votes
4 answers
24k views

pylint can't find QWidget and QApplication

import sys from PyQt5.QtWidgets import (QApplication, QWidget) app = QApplication(sys.argv) window = QWidget() window.setGeometry(50, 50, 500, 300) window.setWindowTitle('Hello, world') window.show() ...
Sergey's user avatar
  • 431
22 votes
2 answers
18k views

PyQt5: Create semi-transparent window with non-transparent children

I want to create a fullscreen window with semitransparent background, but fully visible children widgets (kind of overlay effect). Here's what I have so far: import sys from PyQt5.QtCore import * ...
Enuy's user avatar
  • 629
20 votes
3 answers
28k views

PyQt5: Keyboard shortcuts w/ QAction

How do I implement keyboard shortcuts (to run a function) in PyQt5? I see I'm supposed QAction in one way or another, but I can't put the two and two together, and all examples don't seem to work with ...
Lachlan's user avatar
  • 1,264
19 votes
4 answers
75k views

Can't install PyQt5 using pip

I have tried to install PyQt5 using pip install PyQt5 and sudo -H pip install PyQt5 both of them give me the errors ERROR: Could not find a version that satisfies the requirement PyQt5 (from ...
rsaavedra's user avatar
  • 418
19 votes
2 answers
77k views

How to apply stylesheet to a custom widget in PyQt

# -*- coding: utf-8 -*- import sys from PyQt4.QtGui import * from PyQt4.QtCore import * class MainWindow(QWidget): def __init__(self): super(MainWindow, self).__init__() self....
Anke_Pet's user avatar
  • 354
19 votes
2 answers
18k views

PyQt: No error msg (traceback) on exit

My PyQt application no longer prints the error (stderr?) to the console. I use QtDesigner and import the UI like this: from PyQt5 import QtCore, QtGui, QtWidgets import sys from PyQt5.uic import ...
Jannis's user avatar
  • 401
19 votes
1 answer
56k views

AttributeError: 'Ui_MainWindow' object has no attribute 'setCentralWidget'

I am still working on the GUI for my Database and now i have a different error: Traceback (most recent call last): File "G:\Python\Database Kast Thuis\PyQt Test\MainMenu_ui.py", line 84, in <...
That One's user avatar
  • 587
19 votes
1 answer
13k views

qApp versus QApplication.instance()

With PyQt5, both of these return the application object: app = QtWidgets.QApplication.instance() app = QtWidgets.qApp for i in app.arguments()[1:]: ... But why does print(QtWidgets.QApplication....
Sir Visto's user avatar
  • 693
19 votes
3 answers
13k views

Why in pyqt5 should I use pyuic5 and not uic.loadUi("my.ui")?

I've been experimenting with QT5 for Python, using pyqt5. I've noticed that most tutorials recommend using pyuic5 to convert the XML UI to Python code. I've also seen a couple of tutorials where ...
Frank's user avatar
  • 459

1
2 3 4 5
297