14,750 questions
1
vote
0
answers
62
views
How to remove white space between QTableView and QHeaderView?
Does anyone know how to remove this white space? This is my current stylesheet:
QTableView {
background-color: #EEEEEE;
}
QTableView::item {
background-color: transparent;
}
QHeaderView::...
2
votes
1
answer
86
views
How to prevent QPushButton from growing to fit long text
I have a QPushButton whose width I'd like to keep at a fixed percentage of its parent HBoxLayout width, so that it doesn't grow when its text is set to something very long.
Right now, when the button'...
1
vote
1
answer
67
views
Hard Crash/Fault when running GDAL operations Synchronously in PyQt5 Main Thread
I am experiencing a hard crash (the entire process terminates abruptly) whenever I execute GDAL translation or warping operations (gdal.Translate or gdal.Warp) synchronously in the main GUI thread of ...
1
vote
1
answer
130
views
QTreeView as popup of QComboBox
The goal is to have a QTreeView that doesn't take up real estate on the GUI when not needed.
QComboBox seems like a great vehicle to make that happen. But maybe there's a better way that's similarly ...
2
votes
0
answers
93
views
Python app multithread with pyQT5 delivered as .exe using pyinstaller is crashing after 40-50 minutes
I am developing a multithread application using the library pyQt5. There are many threads activated in order to plot in the GUI some data extracted from many devices (one thread <-> one device). ...
1
vote
1
answer
118
views
Why does this Qt program that creates multiple QApplication objects crash unless I reset a dead local variable?
Program
If the following program is run on Windows with a single command-line
argument, it will crash:
# threading-crash.py
"""Reproduce a crash involving Qt and threading""&...
0
votes
0
answers
35
views
PyQt5 Parent/Child GraphicsItem Hover Behavior
I create several subclassed QGraphicRectItems with parent/child relationships to keep them in lock step on the screen. For whatever reason, the hover events on the children are triggering the parent ...
0
votes
0
answers
72
views
How do I make a Qt5 queued connection in a way that mypy will accept?
Using Python and Qt5, I can make a normal signal connection like this:
def clicked() -> None:
print("clicked")
btn = QtWidgets.QPushButton("Button", window)
btn....
1
vote
0
answers
94
views
PySide6 QThread with Worker never emits finish signal
Before asking the question, I am aware of people having similar problems and reviewed similar questions, but I did not find the answer.
I have tried to follow the example from here to do proper ...
1
vote
1
answer
73
views
Alignment in PyQt5
I've been trying to learn PyQt5 and decided to do some small project. I'm trying to make a guessing game, where you type in a value and the program says if it's correct. My problem is that I centered ...
2
votes
0
answers
76
views
high rate udp data plotting in pyqt5
I am trying to develop a gui to receive data over udp with rate of 72Mbit/s. I am using the pyqtgraph to plot the data of 10 channels. but after receiving some packets, the widow freezes and it seems ...
1
vote
1
answer
110
views
Highlight color problem with QComboBox and QStyledItemDelegate?
First of all, I'd like to point out the following from https://doc.qt.io/archives/qt-5.15/qitemdelegate.html#details :
We recommend the use of QStyledItemDelegate when creating new delegates.
So, ...
1
vote
1
answer
167
views
How do I change the color of the white select all cell on the top right corner? - PyQt5 QTableWidget [duplicate]
The white block on top right corner gets auto added whenever I insert a row.
It selects all rows and columns when I click on it just like in excel
I can see it makes space for S.nos; I've decided it'...
0
votes
1
answer
60
views
Preventing unexpected trigger of setModelData and setData in QTableView with QComboBox?
The code below mostly does what I want: I start out with data of 2D table (list of lists), where 1st and 3rd column start out as random numbers, but 2nd column starts with None. This data is used for ...
0
votes
1
answer
100
views
QTreeWidgetItem disable editing if tab key is pressed
I have an application which uses a QTreeWidget and QTreeWidgetItems. If a new item gets added to the treeWidget (right click -> add item) it is possible to write in column "Header 1". If ...
0
votes
1
answer
70
views
Make QMenu appear disabled in PyQt5?
What I want to do ultimately, is make certain QMenu items in a context menu, which have QAction children, appear disabled (along with their children), but otherwise keep reacting on mouse move events, ...
1
vote
1
answer
32
views
Get spacing between QMenu and QAction in PyQt5?
In the example code below, I'd like to obtain programmatically the spacing (margin? padding?) in pixels between QAction and its encompassing QMenu - see image, where the left and the top spacing are ...
0
votes
1
answer
53
views
QSocketNotifier stops triggering signals while in modal dialog in QT5
I have a client server app where things can happen asynchron, including the server disconnecting and reconnecting. The app has a LED indicator (label with green/red icon) that shows the server ...
0
votes
0
answers
39
views
PyQt vs PySide uic loader difference [duplicate]
I'm migrating some code from PtQy5 to PySide6. I'm experiencing a significant behavioural difference when loading .ui files.
The original PyQt5 code:
import sys
import os
from PyQt5.QtWidgets import ...
1
vote
1
answer
108
views
Must construct a QApplication while it is already constructed?
Here is the code.
import sys
from PyQt6.QtWidgets import QApplication
from qpageview import View
app = QApplication(sys.argv)
view = View()
view.show()
sys.exit(app.exec())
When I run it from ...
0
votes
0
answers
70
views
Unable to bundle pyqt5 app with tensorflow_hub
I have a pyqt5 GUI app (Selecta) which runs perfectly if I run it as a script Selecta.py or if I compile it with the following spec file:
# -*- mode: python ; coding: utf-8 -*-
# from PyInstaller....
1
vote
1
answer
180
views
Is there any way to obtain a listing of enum names and values in a typedef for QFlags? [duplicate]
As such I (questioner) am no longer looking for an answer but I am not sure on what grounds to recommend closing. It could possibly be helpful to someone.
Here's an example of what I mean (based on ...
0
votes
1
answer
78
views
Cannot resize all the widgets [duplicate]
I am trying to adapt a project, which is normally displayed on an external monitor, to my laptop monitor. As you can see from the diagram below, there are 40 rows in the main table. When working from ...
0
votes
0
answers
24
views
Redraw a QPushButton after .setDown is called? [duplicate]
Consider the following example:
import sys
import time
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QMessageBox, QVBoxLayout
from PyQt5.QtCore import QTimer
app = QApplication(sys....
0
votes
0
answers
82
views
PyQt5 GUI freezes after hours while background processing continues (no exceptions thrown)
I'm developing a PyQt5-based desktop application that listens to data from a Kepware OPC server and displays the most recent image (from a camera or screenshot) on a QLabel using QPixmap. There is no ...
1
vote
1
answer
93
views
Run function when leaving QTabWidget tab
I have multiple tabs that a user can switch between. I need a widget on a given tab to run an exit function when that tab is no longer selected. For example, if the user currently has tab_1 selected, ...
1
vote
1
answer
339
views
How can I use Python packages installed with apt-get in a Python interpreter installed with pyenv?
I need help to install a package using apt install in the Raspberry Pi using the Python version I installed using pyenv. I already tried using pip, but the installation fails. The specific package I ...
3
votes
1
answer
98
views
Are Enums optional in PyQt6
I have two python programs running in the same virtual environment using PyQt6.5 on MacOS Sonoma 14.5 and python 3.11. Both execute just fine. One uses the updated enums for PyQt6 for QMessageBox as ...
1
vote
1
answer
98
views
How do you change the position (column and row) of a PyQt QWidget inside a QTableWidget?
I want to move a QWidget from one position to another. I tried the following:
import sys
from PySide6.QtWidgets import (
QApplication, QMainWindow, QTableWidget, QLabel, QPushButton, QVBoxLayout, ...
0
votes
0
answers
104
views
Why does PyQt5 crash on mysql.connector.connect() even though it works separately?
I am developing a ToDo application in Python 3.13.1 with GUI in PyQt5 and connection to MySQL database via mysql-connector-python.
When I run main.py, the application instantly crashes (without even ...
0
votes
2
answers
138
views
How can I change the white color in QComboBox?
I would like to change the color or adjust the size of this rectangle behind the open Combobox
I noticed that there is a problem with the increased size of this white background and the offset options ...
0
votes
1
answer
113
views
PyQt5 Styling QMenu Dropdown?
I made a QMenuBar with a QMenu with two actions. However I can't figure out how to style the dropdown that appears.
My attempt to style the dropdown just isn't working. From what I can tell, QAction ...
0
votes
1
answer
66
views
Python PyQt5 hanging and exiting console when run twice
I was given the code below, which runs great as a standalone script.
What I'm trying to do is turn that standalone script into a function that I can run as many times as I need to.
I've done that, and ...
0
votes
0
answers
102
views
Finding a Proper Way to Use qasync
I have been trying to make a GUI that with the press of a few buttons can send and receive data over a local UDP connection. I am trying to run the UDP connection on one thread and then pass the ...
0
votes
0
answers
51
views
QTreeView/QFileSystemModel sort behavior in PyQt6 differs from PyQt5 -- bug or intentionally changed feature?
I have an application using a QTreeView widget and a subclass of the QFileSystemModel. The purpose of the subclass is to modify the way sorting is done on file type (col 2).
With PyQt5, items are ...
0
votes
0
answers
40
views
Perform cleanup tasks from/in a child QWidget before it is destroyed/closed
Problem
I am trying to create a custom widget which can perform it's own cleanup tasks before it is fully destroyed, but triggered by the application closing. I want to do this because my QWidget ...
0
votes
0
answers
82
views
Pyqt5 layouts: How to arrange all checkboxes
I'm starting to get a little bit of a handle on layouts, because I didn't initially create one. I have three layouts: header_layout (there's a button for the tools menu, a header, and a button for ...
0
votes
0
answers
16
views
Pass text from watchdog to PyQT application [duplicate]
The task is to get a GUI application that will track file system changes and write a log in real time to a text widget. Currently, file system changes are output only to the console.
Any ideas on how ...
-2
votes
1
answer
84
views
Running a function through a for loop with a change in the index in a variable [duplicate]
There are 20 checkboxes in the user's window, in the code their name is checkbox_1, checkbox_2, ... checkbox_20. To activate all the checkboxes at the same time, I use this algorithm:
def select_all_W(...
0
votes
0
answers
73
views
Not activated the widgets of the dialog box made in Qt-designer PyQt5
I wrote code for a board game application to randomly select a team based on the components available to the players. The code with the TkInter add-on works correctly, it is formed as needed, but the ...
1
vote
1
answer
152
views
Qt6 WebEngine C++ API does not use GPU properly
I have been trying to make Qt WebEngine render a google map smoothly for days. But somehow on the C++ API the GPU doesn't get used for the rendering leading to high CPU load and lagging. Funny enough, ...
1
vote
0
answers
33
views
PyQt5 QComboBox: how does the keyboard input work?
I am using PyQt5 QComboBoxes in an application of mine. The ComboBox is filled with Strings which are alphabetically sorted.
I realized that I can move the current index of the ComboBox by typing ...
0
votes
0
answers
30
views
Python VTK Repeated Point Picking Unexpected Behavior
I am using pyQT5 and VTK to render meshes and select points. I have a custom interactor that I use to intercept the QT events and perform operations. For my application, I want to allow the user to ...
0
votes
0
answers
63
views
AtomicInteger in PyQt?
I am attempting to use Qt5's atomic integer class in PyQt5. Apparently, it's available in Qt5 for C++ https://doc.qt.io/qt-5/qatomicint.html
AI on Google recommends importing QAtomicInt via:
from ...
1
vote
2
answers
104
views
How can I place the icon after the text of a QPushButton in PyQt5
How can I place the icon after the text of a QPushButton in PyQt5?
The icon should not come before the text - it should come after or below the text.
Currently it's looking like this:
but it should ...
0
votes
0
answers
117
views
How can I delete the text of an editable ComboBox when the ComboBox receives the focus from outside, and ignore focus changes within (QMenu/Dropdown)?
A short introduction to clarify the context:
I have an editable CustomCombobox (with a CustomLineEdit). This also contains a QMenu, which opens when the Enter key is pressed.
My problem:
I want the ...
1
vote
1
answer
65
views
Conda Environment Update Fails Due to PyQt5 Metadata Generation Error on macOS (ARM)
System Details:
macOS Version: macOS 13
Chip: Apple M2
Conda Version: 23.7.4
Python Version: 3.11
RELION Version: 5.0
PyQt5 Version: 5.15.9
Questions:
Why is PyQt5 failing to build metadata, and how ...
0
votes
1
answer
108
views
Is there a way to make the LineEdit-Part of a Combobox look like the (delegated) Combobox-Items?
I want to change the appearance of a QCombobox including the items and the "LineEdit-Part" to look nice/professional.
The easy part:
The combo box functions both as a search field and for ...
0
votes
1
answer
295
views
How to efficiently plot real-time rolling data with PyQtGraph
What is an efficient method for plotting data with pyqtgraph for a rolling plot when samples arrive one at at time from an upstream process?
Based on some experimentation, plotting each sample as it ...
0
votes
0
answers
74
views
QWebEngineView is not functioning with WebAssembly module (used by Pyodide)
I am using windows 10, PyQt5, monaco and pyodide. I want to display a .html page on a desktop app, via PyQts libraries. The html file runs when I use it on the web, but not via a desktop app using ...