TextEditor#

class omni.kit.widget.text_editor.TextEditor#

Bases: Widget

The binding for ImGuiColorTextEdit.

Methods

__init__(self, **kwargs)

Constructor.

call_edited_fn(self, arg0)

Sets the function that will be called when the editor text changes from the user input.

copy(self)

This function copies selected editor text.

cut(self)

This function cuts selected editor text.

delete(self)

This function deletes selected editor text.

has_edited_fn(self)

Sets the function that will be called when the editor text changes from the user input.

paste(self)

This function pastes to editor.

redo(self[, steps])

This function redoes changes to editor text.

reset_edited(self)

This function resets editor text changed flag.

select_all(self)

This function selects all editor text.

set_edited_fn(self, fn)

Sets the function that will be called when the editor text changes from the user input.

set_error_markers(self, markers)

The error markers show the error message at the specific line.

undo(self[, steps])

This function undoes changes to editor text.

Attributes

current_line_text

The text on the current line.

cursor_position

This property holds the cursor position.

overwrite

Insert mode.

palette

This property holds the language for syntax highlighting.

read_only

Read Only mode is when the user can select, but can't edit.

selected_text

Current selection.

syntax

This property holds the language for syntax highlighting.

text

Get the text to the widget.

text_lines

Get the text lines to the widget.

total_lines

Number of lines in the widget.

__init__(
self: omni.kit.widget.text_editor._text_editor.TextEditor,
**kwargs,
) None#

Constructor.

`kwargsdict`

See below

### Keyword Arguments:

`widthui.Length`

This property holds the width of the widget relative to its parent. Do not use this function to find the width of a screen.

`heightui.Length`

This property holds the height of the widget relative to its parent. Do not use this function to find the height of a screen.

`namestr`

The name of the widget that user can set.

`style_type_name_overridestr`

By default, we use typeName to look up the style. But sometimes it’s necessary to use a custom name. For example, when a widget is a part of another widget. (Label is a part of Button) This property can override the name to use in style.

`identifierstr`

An optional identifier of the widget we can use to refer to it in queries.

`visiblebool`

This property holds whether the widget is visible.

`visibleMinfloat`

If the current zoom factor and DPI is less than this value, the widget is not visible.

`visibleMaxfloat`

If the current zoom factor and DPI is bigger than this value, the widget is not visible.

`tooltipstr`

Set a basic tooltip for the widget, this will simply be a Label, it will follow the Tooltip style

`tooltip_fnCallable`

Set dynamic tooltip that will be created dynamiclly the first time it is needed. the function is called inside a ui.Frame scope that the widget will be parented correctly.

`tooltip_offset_xfloat`

Set the X tooltip offset in points. In a normal state, the tooltip position is linked to the mouse position. If the tooltip offset is non zero, the top left corner of the tooltip is linked to the top left corner of the widget, and this property defines the relative position the tooltip should be shown.

`tooltip_offset_yfloat`

Set the Y tooltip offset in points. In a normal state, the tooltip position is linked to the mouse position. If the tooltip offset is non zero, the top left corner of the tooltip is linked to the top left corner of the widget, and this property defines the relative position the tooltip should be shown.

`enabledbool`

This property holds whether the widget is enabled. In general an enabled widget handles keyboard and mouse events; a disabled widget does not. And widgets display themselves differently when they are disabled.

`selectedbool`

This property holds a flag that specifies the widget has to use eSelected state of the style.

`checkedbool`

This property holds a flag that specifies the widget has to use eChecked state of the style. It’s on the Widget level because the button can have sub-widgets that are also should be checked.

`draggingbool`

This property holds if the widget is being dragged.

`opaque_for_mouse_eventsbool`

If the widgets has callback functions it will by default not capture the events if it is the top most widget and setup this option to true, so they don’t get routed to the child widgets either

`explicit_hoverbool`

If the widgets has callback functions it will by default not capture the events if it is the top most widget and setup this option to true, so they don’t get routed to the child widgets either

`skip_draw_when_clippedbool`

The flag that specifies if it’s necessary to bypass the whole draw cycle if the bounding box is clipped with a scrolling frame. It’s needed to avoid the limitation of 65535 primitives in a single draw list.

`mouse_moved_fnCallable`

Sets the function that will be called when the user moves the mouse inside the widget. Mouse move events only occur if a mouse button is pressed while the mouse is being moved. void onMouseMoved(float x, float y, int32_t modifier)

`mouse_pressed_fnCallable`

Sets the function that will be called when the user presses the mouse button inside the widget. The function should be like this: void onMousePressed(float x, float y, int32_t button, carb::input::KeyboardModifierFlags modifier) Where ‘button’ is the number of the mouse button pressed. ‘modifier’ is the flag for the keyboard modifier key.

`mouse_released_fnCallable`

Sets the function that will be called when the user releases the mouse button if this button was pressed inside the widget. void onMouseReleased(float x, float y, int32_t button, carb::input::KeyboardModifierFlags modifier)

`mouse_double_clicked_fnCallable`

Sets the function that will be called when the user presses the mouse button twice inside the widget. The function specification is the same as in setMousePressedFn. void onMouseDoubleClicked(float x, float y, int32_t button, carb::input::KeyboardModifierFlags modifier)

`mouse_wheel_fnCallable`

Sets the function that will be called when the user uses mouse wheel on the focused window. The function specification is the same as in setMousePressedFn. void onMouseWheel(float x, float y, carb::input::KeyboardModifierFlags modifier)

`mouse_hovered_fnCallable`

Sets the function that will be called when the user use mouse enter/leave on the focused window. function specification is the same as in setMouseHovedFn. void onMouseHovered(bool hovered)

`drag_fnCallable`

Specify that this Widget is draggable, and set the callback that is attached to the drag operation.

`accept_drop_fnCallable`

Specify that this Widget can accept specific drops and set the callback that is called to check if the drop can be accepted.

`drop_fnCallable`

Specify that this Widget accepts drops and set the callback to the drop operation.

`computed_content_size_changed_fnCallable`

Called when the size of the widget is changed.

class Palette#

Bases: pybind11_object

Members:

Dark

Light

RetroBlue

property name#
class Syntax#

Bases: pybind11_object

Members:

NONE

PYTHON

CPLUSPLUS

HLSL

GLSL

C

SQL

ANGELSCRIPT

LUA

property name#
call_edited_fn(
self: omni.kit.widget.text_editor._text_editor.TextEditor,
arg0: bool,
) None#

Sets the function that will be called when the editor text changes from the user input. The function specification is: void onEdited(bool edited)

copy(
self: omni.kit.widget.text_editor._text_editor.TextEditor,
) None#

This function copies selected editor text.

cut(
self: omni.kit.widget.text_editor._text_editor.TextEditor,
) None#

This function cuts selected editor text.

delete(
self: omni.kit.widget.text_editor._text_editor.TextEditor,
) None#

This function deletes selected editor text.

has_edited_fn(
self: omni.kit.widget.text_editor._text_editor.TextEditor,
) bool#

Sets the function that will be called when the editor text changes from the user input. The function specification is: void onEdited(bool edited)

paste(
self: omni.kit.widget.text_editor._text_editor.TextEditor,
) None#

This function pastes to editor.

redo(
self: omni.kit.widget.text_editor._text_editor.TextEditor,
steps: int = 1,
) None#

This function redoes changes to editor text.

reset_edited(
self: omni.kit.widget.text_editor._text_editor.TextEditor,
) None#

This function resets editor text changed flag.

select_all(
self: omni.kit.widget.text_editor._text_editor.TextEditor,
) None#

This function selects all editor text.

set_edited_fn(
self: omni.kit.widget.text_editor._text_editor.TextEditor,
fn: Callable[[bool], None],
) None#

Sets the function that will be called when the editor text changes from the user input. The function specification is: void onEdited(bool edited)

set_error_markers(
self: omni.kit.widget.text_editor._text_editor.TextEditor,
markers: Dict[int, str],
) None#

The error markers show the error message at the specific line.

undo(
self: omni.kit.widget.text_editor._text_editor.TextEditor,
steps: int = 1,
) None#

This function undoes changes to editor text.

property current_line_text#

The text on the current line.

property cursor_position#

This property holds the cursor position.

property overwrite#

Insert mode. It’s possible to activate ot with the key INS.

property palette#

This property holds the language for syntax highlighting.

property read_only#

Read Only mode is when the user can select, but can’t edit.

property selected_text#

Current selection.

property syntax#

This property holds the language for syntax highlighting.

property text#

Get the text to the widget.

property text_lines#

Get the text lines to the widget.

property total_lines#

Number of lines in the widget.