TermTk.TTkWidgets.texedit
TTkTextEditView
- class TTkTextEditView(*args, **kwargs)[source]
- addWidget(widget)
Warning
Method Deprecated,
use
TTkWidget
->layout
->addWidget
i.e.
parentWidget.layout().addWidget(childWidget)
- close()
- document() TTkTextDocument [source]
- dragEnterEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive drag events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkDropEvent
) – The drop event- Returns
True if the event has been handled
- Return type
bool
- dragLeaveEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive drag events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkDropEvent
) – The drop event- Returns
True if the event has been handled
- Return type
bool
- dragMoveEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive drag events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkDropEvent
) – The drop event- Returns
True if the event has been handled
- Return type
bool
- dropEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive drag events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkDropEvent
) – The drop event- Returns
True if the event has been handled
- Return type
bool
- enterEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive mouse enter events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkMouseEvent
) – The mouse event- Returns
True if the event has been handled
- Return type
bool
- getPadding() -> (<class 'int'>, <class 'int'>, <class 'int'>, <class 'int'>)
Retrieve the widget padding sizes
- Returns
list[top, bottom, left, right]: the 4 padding sizes
- hide()
- keyEvent(evt)[source]
This event handler, can be reimplemented in a subclass to receive key events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkKeyEvent
) – The keyboard event- Returns
True if the event has been handled
- Return type
bool
- keyPressEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive key press events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkKeyEvent
) – The keyboard event- Returns
True if the event has been handled
- Return type
bool
- keyReleaseEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive key release events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkKeyEvent
) – The keyboard event- Returns
True if the event has been handled
- Return type
bool
- layout()
Get the layout
- Returns
The layout used
- Return type
TTkLayout
or derived
- leaveEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive mouse leave events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkMouseEvent
) – The mouse event- Returns
True if the event has been handled
- Return type
bool
- lowerWidget()
- mouseDoubleClickEvent(evt) bool [source]
This event handler, can be reimplemented in a subclass to receive mouse click events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkMouseEvent
) – The mouse event- Returns
True if the event has been handled
- Return type
bool
- mouseDragEvent(evt) bool [source]
This event handler, can be reimplemented in a subclass to receive mouse drag events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkMouseEvent
) – The mouse event- Returns
True if the event has been handled
- Return type
bool
- mouseEvent(evt)
Caution
Don’t touch this!
- mouseMoveEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive mouse move events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkMouseEvent
) – The mouse event- Returns
True if the event has been handled
- Return type
bool
- mousePressEvent(evt) bool [source]
This event handler, can be reimplemented in a subclass to receive mouse press events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkMouseEvent
) – The mouse event- Returns
True if the event has been handled
- Return type
bool
- mouseReleaseEvent(evt) bool [source]
This event handler, can be reimplemented in a subclass to receive mouse release events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkMouseEvent
) – The mouse event- Returns
True if the event has been handled
- Return type
bool
- mouseTapEvent(evt) bool [source]
This event handler, can be reimplemented in a subclass to receive mouse click events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkMouseEvent
) – The mouse event- Returns
True if the event has been handled
- Return type
bool
- move(x: int, y: int)
Move the widget
- Parameters
x (int) – x position
y (int) – y position
- moveEvent(x: int, y: int)
Event Callback triggered after a successful move
- name() str
- paintChildCanvas()
Caution
Don’t touch this!
- raiseWidget(raiseParent=True)
- removeWidget(widget)
Warning
Method Deprecated,
use
TTkWidget
->layout
->removeWidget
i.e.
parentWidget.layout().removeWidget(childWidget)
- resize(w: int, h: int)
Resize the widget
- Parameters
w (int) – the new width
h (int) – the new height
- setDisabled(disabled=True)
- setDocument(document: TTkTextDocument)[source]
- setEnabled(enabled: bool = True)
- setFocus()
- setGeometry(x: int, y: int, w: int, h: int)
Resize and move the widget
- Parameters
x (int) – x position
y (int) – y position
w (int) – the new width
h (int) – the new height
- setName(name: str)
- setPadding(top: int, bottom: int, left: int, right: int)
Set the padding of the widget
- Parameters
top (int) – top padding
bottom (int) – bottom padding
left (int) – left padding
right (int) – right padding
- setVisible(visible: bool)
- show()
- wheelEvent(evt)
This event handler, can be reimplemented in a subclass to receive mouse wheel events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkMouseEvent
) – The mouse event- Returns
True if the event has been handled
- Return type
bool
TTkTextEdit
- class TTkTextEdit(textEditView=None, lineNumber=False, lineNumberStarting=0, **kwargs)[source]
╔═══════════════════════════════════════════════════════════════════════════════════════╗ ║ 0▌"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor ╥ ║ ║ <▌incididunt ut labore et dolore magna aliqua. ║ ║ ║ 1▌ ║ ║ ║ 2▌Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliqu║ ║ ║ <▌ip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate ║ ║ ║ <▌velit esse cillum dolore eu fugiat nulla pariatur. ║ ║ ║ 3▌ ║ ║ ║ 4▌Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deseru║ ║ ║ <▌nt mollit anim id est laborum." ╨ ║ ╚═══════════════════════════════════════════════════════════════════════════════════════╝
Demo: textedit.py (Try Online)
- Parameters
lineNumber (bool, optional) – Show the line number on the left, defaults to False
readOnly (bool, optional) – In a read-only text edit the user can only navigate through the text and select text; modifying the text is not possible, defaults to True
multiLine (bool, optional) – In a multiline text edit the user can split the text in multiple lines, defaults to True
document (
TTkTextDocument
, optional) – If required an external Document can be used in this text editor, this option is useful if multiple editors share the same document as in the demo, defaults to a new Document
- signal currentColorChanged(color)
This signal is emitted if the current character color has changed, for example caused by a change of the cursor position.
- Parameters
color (
TTkColor
) – the new color
- signal undoAvailable(available)
This signal is emitted whenever undo operations become available (available is true) or unavailable (available is false).
- Parameters
available (bool) – the availability of undo
- signal redoAvailable(available)
This signal is emitted whenever redo operations become available (available is true) or unavailable (available is false).
- Parameters
available (bool) – the availability of redo
- signal textChanged()
This signal is emitted whenever the document’s content changes; for example, when text is inserted or deleted, or when formatting is applied.
- toAnsi()
- clear()
This method is forwarded to
clear()
- setText(text)
This method is forwarded to
setText()
- append(text)
This method is forwarded to
append()
- isReadOnly()
This method is forwarded to
isReadOnly()
- setReadOnly(ro)
This method is forwarded to
setReadOnly()
- document()
This method is forwarded to
document()
- wrapWidth()
This method is forwarded to
wrapWidth()
- setWrapWidth(width)
This method is forwarded to
setWrapWidth()
- multiLine()
This method is forwarded to
multiLine()
- lineWrapMode()
This method is forwarded to
lineWrapMode()
- setLineWrapMode(mode)
This method is forwarded to
setLineWrapMode()
- wordWrapMode()
This method is forwarded to
wordWrapMode()
- setWordWrapMode(mode)
This method is forwarded to
setWordWrapMode()
- textCursor()
This method is forwarded to
textCursor()
- setColor(color)
This method is forwarded to
setColor()
- cut()
This method is forwarded to
cut()
- copy()
This method is forwarded to
copy()
- paste()
This method is forwarded to
paste()
- undo()
This method is forwarded to
undo()
- redo()
This method is forwarded to
redo()
- isUndoAvailable()
This method is forwarded to
isUndoAvailable()
- isRedoAvailable()
This method is forwarded to
isRedoAvailable()
- toRawText()
This method is forwarded to
toRawText()
- toPlainText()
This method is forwarded to
toPlainText()
- addWidget(widget)
Warning
Method Deprecated,
use
TTkWidget
->layout
->addWidget
i.e.
parentWidget.layout().addWidget(childWidget)
- close()
- dragEnterEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive drag events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkDropEvent
) – The drop event- Returns
True if the event has been handled
- Return type
bool
- dragLeaveEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive drag events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkDropEvent
) – The drop event- Returns
True if the event has been handled
- Return type
bool
- dragMoveEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive drag events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkDropEvent
) – The drop event- Returns
True if the event has been handled
- Return type
bool
- dropEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive drag events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkDropEvent
) – The drop event- Returns
True if the event has been handled
- Return type
bool
- enterEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive mouse enter events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkMouseEvent
) – The mouse event- Returns
True if the event has been handled
- Return type
bool
- getPadding() -> (<class 'int'>, <class 'int'>, <class 'int'>, <class 'int'>)
Retrieve the widget padding sizes
- Returns
list[top, bottom, left, right]: the 4 padding sizes
- hide()
- keyEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive key events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkKeyEvent
) – The keyboard event- Returns
True if the event has been handled
- Return type
bool
- keyPressEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive key press events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkKeyEvent
) – The keyboard event- Returns
True if the event has been handled
- Return type
bool
- keyReleaseEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive key release events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkKeyEvent
) – The keyboard event- Returns
True if the event has been handled
- Return type
bool
- layout()
Get the layout
- Returns
The layout used
- Return type
TTkLayout
or derived
- leaveEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive mouse leave events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkMouseEvent
) – The mouse event- Returns
True if the event has been handled
- Return type
bool
- lowerWidget()
- mouseDoubleClickEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive mouse click events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkMouseEvent
) – The mouse event- Returns
True if the event has been handled
- Return type
bool
- mouseDragEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive mouse drag events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkMouseEvent
) – The mouse event- Returns
True if the event has been handled
- Return type
bool
- mouseEvent(evt)
Caution
Don’t touch this!
- mouseMoveEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive mouse move events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkMouseEvent
) – The mouse event- Returns
True if the event has been handled
- Return type
bool
- mousePressEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive mouse press events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkMouseEvent
) – The mouse event- Returns
True if the event has been handled
- Return type
bool
- mouseReleaseEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive mouse release events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkMouseEvent
) – The mouse event- Returns
True if the event has been handled
- Return type
bool
- mouseTapEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive mouse click events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkMouseEvent
) – The mouse event- Returns
True if the event has been handled
- Return type
bool
- move(x: int, y: int)
Move the widget
- Parameters
x (int) – x position
y (int) – y position
- moveEvent(x: int, y: int)
Event Callback triggered after a successful move
- name() str
- paintChildCanvas()
Caution
Don’t touch this!
- raiseWidget(raiseParent=True)
- removeWidget(widget)
Warning
Method Deprecated,
use
TTkWidget
->layout
->removeWidget
i.e.
parentWidget.layout().removeWidget(childWidget)
- resize(w: int, h: int)
Resize the widget
- Parameters
w (int) – the new width
h (int) – the new height
- resizeEvent(w: int, h: int)
Event Callback triggered after a successful resize
- setDisabled(disabled=True)
- setEnabled(enabled: bool = True)
- setGeometry(x: int, y: int, w: int, h: int)
Resize and move the widget
- Parameters
x (int) – x position
y (int) – y position
w (int) – the new width
h (int) – the new height
- setName(name: str)
- setPadding(top: int, bottom: int, left: int, right: int)
Set the padding of the widget
- Parameters
top (int) – top padding
bottom (int) – bottom padding
left (int) – left padding
right (int) – right padding
- setVisible(visible: bool)
- show()
- wheelEvent(evt) bool
This event handler, can be reimplemented in a subclass to receive mouse wheel events for the widget.
Note
Reimplement this function to handle this event
- Parameters
evt (
TTkMouseEvent
) – The mouse event- Returns
True if the event has been handled
- Return type
bool