enable.trait_defs.ui.kiva_font_editor module

class enable.trait_defs.ui.kiva_font_editor.KivaFontEditor(*args, **traits)[source]

Bases: traitsui.editor_factory.EditorFactory

Editor factory for KivaFontEditors

format_func = Callable(str_font)

The default format func displays a description of the font.

high_resolution = Bool(True)

Switch to turn off high resolution rendering if needed.

sample_text = Str()

Alternative text to display instead of the font description.

class enable.trait_defs.ui.kiva_font_editor.ReadOnlyEditor(parent, **traits)[source]

Bases: enable.trait_defs.ui.editor_with_component.EditorWithLabelComponent

An Editor which displays a label using the font.


Create and initialize the underlying toolkit widget.

This method must be overriden by subclasses. Implementations must ensure that the control trait is set to an appropriate toolkit object.


parent (toolkit control) – The parent toolkit object of the editor’s toolkit objects.

string_value(value, format_func=None)[source]

Get a string value to display in the editor.

If the factory provides sample text, use that, otherwise follow the usual path, but default to using the str_font function.


Handle the content of the editor changing.

class enable.trait_defs.ui.kiva_font_editor.SimpleEditor(parent, **traits)[source]

Bases: enable.trait_defs.ui.kiva_font_editor.ReadOnlyEditor

An Editor which displays a label using the font, click for font dialog.

button = Instance(ButtonTool)

Button tool connected to the Label component.


Display a Pyface FontDialog when the button tool is clicked.


Create and configure the Label component.


Handle changes to the font due to user action.

enable.trait_defs.ui.kiva_font_editor.WEIGHTS = {100: ' Thin', 200: ' Extra-light', 300: ' Light', 400: '', 500: ' Medium', 600: ' Semi-bold', 700: ' Bold', 800: ' Extra-bold', 900: ' Heavy', 1000: ' Extra-heavy'}

A mapping of Kiva weight constants to strings.


Returns a Font’s typeface name.


Returns the text representation of the specified font trait value