Skip to content
Advertisement

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 original Qt documentation mentions the setIcon() method but i couldnt

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 comparing an int(the value sent by the stateChanged signal) and

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 “Ku” then textbox1.text will be replaced by the Tamil

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 pressed:

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 comboboxes you

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::itemClicked and note that the

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 getting an output where all three images blend together equally. This

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 left-most column “frozen”.

Advertisement