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
25
votes
4 answers

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). Is there any way (either direct or indirect) to…
aoh
  • 1,090
  • 2
  • 13
  • 25
25
votes
7 answers

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
  • 967
  • 2
  • 18
  • 39
25
votes
5 answers

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
  • 1,245
  • 5
  • 18
  • 34
24
votes
3 answers

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 Python=3.6.1 class App(QWidget): def…
Taimur Islam
  • 960
  • 2
  • 11
  • 25
24
votes
5 answers

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__() self.setWindowIcon(QtGui.QIcon('icon.png')) I…
HumanAfterAll
  • 341
  • 1
  • 2
  • 6
23
votes
8 answers

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
  • 4,769
  • 5
  • 32
  • 64
23
votes
3 answers

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 Could not find any downloads that satisfy the…
Babken Vardanyan
  • 14,090
  • 13
  • 68
  • 87
22
votes
3 answers

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() sys.exit(app.exec_()) I just started to learn…
Sergey
  • 421
  • 1
  • 5
  • 14
21
votes
3 answers

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): path = self.lineEdit.text() df =…
Joe T. Boka
  • 6,554
  • 6
  • 29
  • 48
21
votes
2 answers

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 * from PyQt5.QtGui import * from PyQt5.QtWidgets…
Enuy
  • 619
  • 1
  • 7
  • 21
21
votes
2 answers

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 this error C:\Python34\python.exe…
Sнаđошƒаӽ
  • 16,753
  • 12
  • 73
  • 90
20
votes
1 answer

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 have to assign the text from the qtextedit to a…
Abunis
  • 207
  • 1
  • 2
  • 9
20
votes
3 answers

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 PyQt5 but instead PyQt4.
Lachlan
  • 1,245
  • 5
  • 18
  • 34
19
votes
9 answers

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, so it didn't crash or anything. Is there a…
user14490575
19
votes
2 answers

How can I make QScintilla auto-indent like SublimeText?

Consider the below mcve: import sys import textwrap from PyQt5.Qsci import QsciScintilla from PyQt5.Qt import * if __name__ == '__main__': app = QApplication(sys.argv) view = QsciScintilla() …
BPL
  • 9,632
  • 9
  • 59
  • 117