traitsui.null.font_trait module

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

class traitsui.null.font_trait.TraitFont

Bases: traits.trait_handlers.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. For example, TraitRange instances return a string indicating the range of values acceptable to the handler (e.g., “an integer in the range from 1 to 9”). If the info() method is not overridden, the default method returns the value of the ‘info_text’ attribute.

validate(object, name, value)

Validates that the value is a valid font descriptor string.

traitsui.null.font_trait.get_font_editor(*args, **traits)

Previous topic

traitsui.null.color_trait module

Next topic

traitsui.null.rgb_color_trait module

This Page