traitsui.null.font_trait module

Trait definition for a null-based (i.e., no UI) font.

class traitsui.null.font_trait.TraitFont[source]

Bases: TraitHandler

Ensures that values assigned to a trait attribute are valid font descriptor strings; the value actually assigned is the corresponding canonical font descriptor string.


Must return a string describing the type of value accepted by the trait handler.

The string should be a phrase describing the type defined by the TraitHandler subclass, rather than a complete sentence. For example, use the phrase, “a square sprocket” instead of the sentence, “The value must be a square sprocket.” The value returned by info() is combined with other information whenever an error occurs and therefore makes more sense to the user if the result is a phrase. The info() method is similar in purpose and use to the info attribute of a validator function.

Note that the result can include information specific to the particular trait handler instance. If the info() method is not overridden, the default method returns the value of the ‘info_text’ attribute.

validate(object, name, value)[source]

Validates that the value is a valid font descriptor string.

traitsui.null.font_trait.get_font_editor(*args, **traits)[source]