qt

Print out array in table widget

Print out array in table widget Question: How to print out 1d array in table widget? I have array Sum_main(float data) and table table_Sum. Table has 1 col and 5 rows. I tried this: item=self.ui.table_Sum(str(Sum_main)) for row in range(5): self.ui.table_Sum.setItem(row, 0, self.ui.table_Sum.item(str(Sum_main[row][0]))) But get error: TypeError: ‘QTableWidget’ object is not callable. I have textEdit but …

Total answers: 1

How to solve the problem "TypeError: setEnabled(self, bool): argument 1 has unexpected type 'str'"?

How to solve the problem "TypeError: setEnabled(self, bool): argument 1 has unexpected type 'str'"? Question: I have encountered such a problem ` > python .main.py Traceback (most recent call last): File "C:main.py", line 79, in writeF self.ui.lineEdit.setEnabled(value) TypeError: setEnabled(self, bool): argument 1 has unexpected type ‘str’ ` My code is hosted on github, here’s the …

Total answers: 1

QStandardItemModel delete multiple rows without problem – python

QStandardItemModel delete multiple rows without problem – python Question: I’m coding a reddit bot and created a UI like this: What I want to do is user selects an account from list, clicks the remove selected account and all checked accounts deleted from list. So here is my code: def delete_selected_accounts(self): print(len(self.account_list)) for i in …

Total answers: 1

Position of cursor rectangle in QTextEdit (PySide6)

Position of cursor rectangle in QTextEdit (PySide6) Question: I need to get absolute cursor position (in pixels) in QTextEdit. I try from PySide6 import QtCore, QtWidgets, QtGui class MyWidget(QtWidgets.QWidget): def __init__(self, parent): super().__init__(parent) self.text_edit = QtWidgets.QTextEdit(self) self.text_edit.setGeometry(10, 10, 100, 100) self.cursor = QtGui.QTextCursor(self.text_edit.document()) self.cursor.insertText(‘abc yz abc’) self.cursor = QtGui.QTextCursor(self.text_edit.document()) self.cursor.setPosition(4) self.cursor.movePosition(QtGui.QTextCursor.MoveOperation.Right, QtGui.QTextCursor.MoveMode.KeepAnchor, 2) self.text_edit.setTextCursor(self.cursor) print(self.text_edit.cursorRect(self.cursor)) …

Total answers: 1

Trying to make a dark- lightmode switcher

Trying to make a dark- lightmode switcher Question: I’m trying to make a Button which switches between light and dark mode. Switching to dark mode is pretty easy, but switching to light mode again is a bit complicated. I am trying to switch to the default Palette but I don’t know how it really works. …

Total answers: 1

PyQt5 – QTime not changing values

PyQt5 – QTime not changing values Question: I wanted to create a simple timer that gets shown to the screen and was using QTime to track the amount of time passed. However when I create a time with QTime(0, 0, 0) it will always stay at the initial value and will never change. from PyQt5.QtCore …

Total answers: 3

Remove margin around QTabWidget in python

Remove margin around QTabWidget in python Question: I am making a web browser in qt5 for fun, however there is a margin between the QTabWidget and the window, and does not look appealing. Is there any way to remove it? Here is the app class code class App(QWidget): def __init__(self) -> None: super().__init__() #self.windowTitle = …

Total answers: 1

python exe error when importing PyQt5 and opening Mixxx

python exe error when importing PyQt5 and opening Mixxx Question: I have made a small program for dj automation. The code: #from PyQt5 import QtCore, QtGui, QtWidgets from pywinauto.application import Application as PyWinAutoApplication from subprocess import Popen import time import os os.environ["QT_DEBUG_PLUGINS"] = "1" #Open mixxx Popen(r’C:Program FilesMixxxmixxx.exe’) #time.sleep(5) #mixxx_app = PyWinAutoApplication(backend="uia").connect(title="Mixxx") while(True): time.sleep(10) if …

Total answers: 1

Hello everybody,

Hello everybody, Question: I’m trying to write a program that should move an X in a defined frame. For this purpose, a while loop should start with a KeyPress and stop with a KeyReleases. I only found the multithreading or multiprocessing methods on the Internet to do that simultaneously. The multithreading itself works for a …

Total answers: 1

PyQT: Storing multidimensional data and displaying as QTableView using model/view framework

PyQT: Storing multidimensional data and displaying as QTableView using model/view framework Question: EDIT: I’ve changed my approach since asking this question – see answer below. I’m building an application which displays data in a series of tables. I’m currently using PyQT’s item-based QTableWidget and manually updating the tables whenever data changes. I’d like to migrate …

Total answers: 1