pyface.i_python_editor module

A widget for editing Python code.

class pyface.i_python_editor.IPythonEditor(adaptee, default=<class 'traits.adaptation.adaptation_error.AdaptationError'>)[source]

Bases: ILayoutWidget

A widget for editing Python code.

dirty = Bool(False)

Has the file in the editor been modified?

path = Str()

The pathname of the file being edited.

show_line_numbers = Bool(True)

Should line numbers be shown in the margin?

changed = Event()

The contents of the editor has changed.

key_pressed = Event(KeyPressedEvent)

A key has been pressed.

load(path=None)[source]

Loads the contents of the editor.

Parameters

path (str or None) – The path to the file to load.

save(path=None)[source]

Saves the contents of the editor.

Parameters

path (str or None) – The path to the file to save.

set_style(n, fore, back)[source]

Set the foreground and background colors for a particular style and set the font and size to default values.

select_line(lineno)[source]

Selects the specified line.

Parameters

lineno (int) – The line number to select.

class pyface.i_python_editor.MPythonEditor[source]

Bases: HasTraits

The mixin class that contains common code for toolkit specific implementations of the IPythonEditor interface.

Implements: _changed_path()