pyqt5

How to enable mouse tracking on a QLabel that has RichText

How to enable mouse tracking on a QLabel that has RichText Question: I really want a single QLabel to have different colours for different parts of the string. Past questions have led me to the solution of using HTML4 rich text options within it, for example: ‘<font color="red">I’m red! </font><font color="blue">I’m blue!</font>’ This solution works …

Total answers: 1

How to fix: TypeError: filter expected 2 arguments, got 1

How to fix: TypeError: filter expected 2 arguments, got 1 Question: I am making a browser using python and PyQt5/PySide6. I implemented an adblock which uses a list to block ads from opening as tabs. ` class WebPage(QWebEnginePage): adblocker = filter(open(os.path.join("build files", "adlist.txt"), encoding="utf8")) def __init__(self, parent=None): super().__init__(parent) def acceptNavigationRequest(self, url, _type, isMainFrame): urlString = …

Total answers: 1

Drag and drop files to QListWidget created with QT-Designer

Drag and drop files to QListWidget created with QT-Designer Question: i am trying to implement a drag and drop feature to PyQt5 QListWidget it works if self.acceptDrops(True) is in the code but it works on whole application window and wherever i drag file in the window it will add a file to QListWidget… My goal …

Total answers: 1

Add dropdown actions to Pyqt5 frame widget when right-click event is triggered

Add dropdown actions to Pyqt5 frame widget when right-click event is triggered Question: I have a Qframe widget and I already created an event triger like this def mousePressEvent(self, QMouseEvent): if QMouseEvent.button() == Qt.RightButton: # do what you want here print("Right Button Clicked") #showMenuAtMouseLocation() # to be implemented I want a small menu list to …

Total answers: 1

How to get an old_value from handleItemChanged on QTableWidget in PyQt5

How to get an old_value from handleItemChanged on QTableWidget in PyQt5 Question: I have a question related to QTableWidget and handleItemChanged. Is there a way to get the before change and after the change values for comparison? import sys from PyQt5.QtCore import * from PyQt5 import QtCore from PyQt5.QtGui import * from PyQt5.QtWidgets import * …

Total answers: 1

Is it possible to disable the highlighting effect on a selected cell in a QTableWidget?

Is it possible to disable the highlighting effect on a selected cell in a QTableWidget? Question: In this example, I have a grid with cells that can be colored and uncolored. import sys from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * class MainWindow(QMainWindow): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.setGeometry(100, 100, …

Total answers: 1

Error installing pyqt5 under aarch64 architecture

Error installing pyqt5 under aarch64 architecture Question: I’m trying to install pyqt5 V5.15.2 on an emulate qemu aarch64 debian distro, but it fails with the following trace: root@debian-arm64:~# pip install pyqt5==5.15.2 –config-settings –confirm-license= –verbose Using pip 23.0.1 from /usr/local/lib/python3.9/dist-packages/pip (python 3.9) Collecting pyqt5==5.15.2 Using cached PyQt5-5.15.2.tar.gz (3.3 MB) Running command pip subprocess to install build …

Total answers: 2

Change a label after a specified time

Change a label after a specified time Question: I am trying to change a label on a button click and then after 3 seconds I want it to change back to nothing ("") my code is this: def apply_click(self): ui.label_ischanged.setText("Applied!") and I connected it to my button then I used time.sleep(3) but I know that …

Total answers: 1

Why do similar signal/slot connections behave differently after Pyqt5 to PySide6 port

Why do similar signal/slot connections behave differently after Pyqt5 to PySide6 port Question: I’m porting a pyqt5 GUI to pyside6 and I’m running into an issue I don’t understand. I have two QSpinboxes that control two GUI parameters: One spinbox controls the weight of a splitter, the other controls the row height in a QtableView. …

Total answers: 2

PyQT5 – how to use QWidget, QScrollArea and QBrush all together

PyQT5 – how to use QWidget, QScrollArea and QBrush all together Question: I am trying to: Display an image which is bigger than the window size; Make the window scrollable, so I can roll through the whole image; Draw over the image; Problem is: As soon as I make the window scrollable, I can’t see …

Total answers: 2