traitsui.editors.code_editor module

Defines the code editor factory for all traits toolkit backends, useful for tools such as debuggers.

class traitsui.editors.code_editor.CodeEditor(*args, **traits)[source]

Bases: EditorFactory

Editor factory for code editors.

auto_scroll = Bool(True)

Should the editor auto-scroll when a new selected_line value is set?

auto_set = Bool(True)

Is user input set on every change?

calltip_clicked = Str()

Calltip clicked event

column = Str()

Current column

dim_color = Str()

Object trait to dim lines to. Can be of form #rrggbb or a color spec. If not specified, dark grey is used.

dim_lines = Str()

Object trait containing the list of line numbers to dim (optional)

foldable = Bool(True)

Should code folding be enabled?

key_bindings = Instance("traitsui.key_bindings.KeyBindings")

Optional key bindings associated with the editor

lexer = Str("python")

The lexer to use. Default is ‘python’; ‘null’ indicates no lexing.

line = Str()

Current line

mark_color = Color(0xECE9D8)

Background color for marking lines

mark_lines = Str()

Object trait containing list of line numbers to mark (optional)

search = Enum("top", "bottom", "none")

Where should the search toolbar be placed?

search_color = Color(0xFFFF94)

Background color for lines that match the current search

selected_color = Color(0xA4FFFF)

Background color for selected lines

selected_end_pos = Str()

Object trait containing the currently selected text end position (optional)

selected_line = Str()

Object trait containing the currently selected line (optional)

selected_start_pos = Str()

Object trait containing the currently selected text start position (optional)

selected_text = Str()

Object trait containing the currently selected text (optional)

show_line_numbers = Bool(True)

Should line numbers be displayed in the margin?

squiggle_color = Str()

Object trait for the color of squiggles. If not specified, red is used.

squiggle_lines = Str()

Object trait containing the list of line numbers to put squiggles under (optional)

traitsui.editors.code_editor.ToolkitEditorFactory

alias of CodeEditor