Skip to content

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…

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…

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…