I’m trying to load a UI file using PyQt5.uic.loadUi which has QWebEngineView, but my code currently loads a blank QT form. It was working before until I changed the way classes were referencing each other. I’m new to working with classes and cannot understand the correct use of self and parent. de…
Tag: pyqt
Best way of getting Qt pushbuttons Icons information in python?
Im developing a PyQt application which modifies buttons icons dynamically. The icons are created with QStyle, stored as class parameters and then put into the buttons with the setIcon() method. Since the icons are modified dynamically, i want an elegant way of checking what is the current button icon. The ori…
How to avoid the processing, if an unnecessary key is pressed (include or exclude user-defined, pre-defined keyss) in PyQt5?
How to avoid the processing, if an unnecessary key is pressed? For Example, In my code, I use Right Arrow and Left Arrowkey in keyPressEvent to move from one label to another label. and I assign keys F5, Alt+ A and ctrl+alt+p as shortcuts for labels. By default to print the First label “Accounts” …
Qt.CheckState.Checked != 2 and Qt.CheckState.Checked != 0
The PyQt6 documentation says that Qt.CheckState.Unchecked == 0 and Qt.CheckState.Checked == 2. I wrote a little program to test this, but the result is completely different. Here is the program code: But when I click on the checkbox, the following is displayed: Why? Answer The problem is that you are comparin…
How to Create a Tamil Phonetic keyboard inputs in python?
My target: create a Phonetic Keyboard in the Tamil language, using dictionary key mapping. My struggle: How to replace my keys with values and set that value to my textbox. For Example: If I press “K” in textbox1, then my textbox1.text will change into the Tamil letter “க்”, if I press…
PyQt5 very simple button input dialog
I thought I’ll try pyqt(5) for a change and wanted to create a simple dialog on startup of a script that let’s the user choose one of three options. My goal is a popup like this (on startup of a script) that will close on pushing one of the buttons and returns the value of the button that was pres…
Iterate through multiple combo boxes in a container pyqt
I’m having a problem with extracting data from multiple comboboxes at once. I have around 10 comboboxes in a container. I could extract the data individual but that would result in repeated code. This is what I have so far but doesn’t seem to work at all: Answer First of all you will need to have all the comb…
How to get the text of the clicked item of Listwidget in PyQt5?
I was looking for a method to get a text/ name of the clicked element on a listWidget. This was my approach looks like: but it always crashes and gives me this error: Could someone please tell me what Im doing wrong? Answer The signature of your slot lamp_clicked is wrong. Take a look at QListWidget::itemClic…
Overlaying Images in a QLabel for Onion Skinning
I’m trying to produce an onion skin effect using a QLabel in PyQt. In the simplified example below, three images are loaded in and drawn to the label using QPainter. Ideally, the last image would show as fully opaque, with earlier images having an increasingly higher transparency. Instead, I’m get…
Frozen widgets in QScrollArea
I’m trying to create a grid of square buttons that is scrollable if the window is too small to show all of them. I’d like there to be labels on the left-most column and top-most row showing the button indices. Is there a way to create a QScrollArea with the widgets (labels) in the top-most row and…