pyqt

PyQt6: Removing ALL padding around widget

PyQt6: Removing ALL padding around widget Question: I’m trying push two QLineEdit-widgets all the way up to each other, but no matter how and when i call setContentsMargins(0,0,0,0) , it just does not seem to remove all margins. I’ve tried googling, but all comments just say "use layout.setContentsMargins(0,0,0,0)", and that’s it. Can somebody explain to …

Total answers: 1

PySide2 – Widget above a widget with a shadow effect moves under the second

PySide2 – Widget above a widget with a shadow effect moves under the second Question: I am writing a virtual keyboard for an app that will be using with touch screen. If you wanna ask me, why i don’t use pyqt virtual keyboard, i’ll answer that my keyboard must have some additional buttons and function. …

Total answers: 1

Print directly to a PyQt StatusBar

Print directly to a PyQt StatusBar Question: I have two classes. One for my GUI in PyQt6 and the other one that executes a function. In my interface, I have a PyQt StatusBar and a Button. When I press the button, I call the other class. I would like to be able to modify the …

Total answers: 1

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

Error while trying to pass variable from one window to another

Error while trying to pass variable from one window to another Question: Trying to pass varibale from one window to another, so depending on number of this varibale(1 or 2) some buttons will be hiden or not. Was following this video https://youtu.be/u1BvQylSIo8, but when I print self.ui=Ui_MainWindow(self.fg) (self.fg is variable that need to be sent) …

Total answers: 1

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

QGridLayout not affected by styleSheet

QGridLayout not affected by styleSheet Question: Using Qt Designer I created GUI for my project. Added: groupBox which has gridLayout with few QLabels and QtextEdits. I changed color of groupBox with this(using styleSheet): QGroupBox { background-color: qlineargradient(spread:pad, x1:0.502, y1:1, x2:0.493, y2:0, stop:0 rgba(10, 15, 73, 255), stop:1 rgba(30, 46, 223, 255)); border: none; padding: 5px; …

Total answers: 1

QTreeView column header width is too large

QTreeView column header width is too large Question: I am trying to set up a simple QTreeView with nice columns. The first two columns are set to fit the contents, the last column is set to stretch. For some reason, the minimum width of the last column ("Balance") is way higher than it needs to …

Total answers: 1

TypeError when calling parent class despite passing parameter

TypeError when calling parent class despite passing parameter Question: I have a class TextElement which inherits from PyQt-class QTextEdit and a custom class BaseElement. BaseElement needs the parameter "transmitter" which is passed by the parameter "transmitter" of TextElement itself. Despite doing everthing accordingly I get the TypeError: Traceback (most recent call last): File "…HotTeacherpackagetblock.py", line …

Total answers: 1

Why can't I sort columns in my PyQt5 QTableWidget using UserRole data?

Why can't I sort columns in my PyQt5 QTableWidget using UserRole data? Question: I am trying to sort my QTableWidget columns by the values stored in the user role of each QTableWidgetItem, but I am unable to do so. I have enabled sorting with self.setSortingEnabled(True), and I have set the data in each QTableWidgetItem with …

Total answers: 2