qtextedit

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

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

pyside QTextEdit selected text event

pyside QTextEdit selected text event Question: I have a QTextEdit widget layed out on the left and a QTextBrowser on the right, I am looking for a way to do the following: the user select a some text a function is triggered by this event the selected text is processed the processed text is displayed …

Total answers: 1

Change text selection in PyQt QTextEdit

Change text selection in PyQt QTextEdit Question: I’m trying to select different text in a QTextEdit object. def get_text_cursor(self): return self.TextEdit.textCursor() def get_text_selection(self): cursor = self.get_text_cursor() return cursor.selectionStart(), cursor.selectionEnd() def set_text_selection(self, start, end): cursor = self.get_text_cursor() cursor.setPosition(start, end) self.TextEdit.setTextCursor(cursor) This code does NOT work (get_text_selection does work) I have tried other things as well and …

Total answers: 2

Scrolling in QScrollArea pyqt

Scrolling in QScrollArea pyqt Question: How can I auto scroll for the scroll area? For example, when there is a new update instead of the view of the scroll area staying the same, I want to go down with the new text. Think of it as in a CMD console, when you type a command …

Total answers: 2