pyface.ui_traits module¶
Defines common traits used within the pyface library.
- pyface.ui_traits.convert_image(value, level=3)[source]¶
Converts a specified value to an ImageResource if possible.
- pyface.ui_traits.convert_bitmap(image)[source]¶
Converts an ImageResource to a bitmap using a cache.
- class pyface.ui_traits.Image(value=None, **metadata)[source]¶
Bases:
TraitTypeDefines a trait whose value must be a IImage or a string that can be converted to an IImageResource.
- default_value = None¶
Define the default value for the trait.
- info_text = 'an IImage or string that can be used to define an ImageResource'¶
A description of the type of value this trait accepts.
- class pyface.ui_traits.PyfaceColor(value=None, **metadata)[source]¶
Bases:
TraitTypeA Trait which casts strings and tuples to a Pyface Color value.
- default_value_type = 7¶
The default value should be a tuple (factory, args, kwargs).
- class pyface.ui_traits.PyfaceFont(value=None, *, parser=<function simple_parser>, **metadata)[source]¶
Bases:
TraitTypeA Trait which casts strings to a Pyface Font value.
- default_value_type = 7¶
The default value should be a tuple (factory, args, kwargs)
- parser = None¶
The parser to use when converting text to keyword args. This should accept a string and return a dictionary of Font class trait values (ie. “family”, “size”, “weight”, etc.).
- class pyface.ui_traits.BaseMB(*args, **traits)[source]¶
Bases:
ABCHasStrictTraitsBase class for Margins and Borders
The constructor of this class maps posiitonal arguments to traits.
If one value is provided it is taken as the value for all sides.
If two values are provided, then the first argument is used for left and right, while the second is used for top and bottom.
If 4 values are provided, then the arguments are mapped to left, right, top, and bottom, respectively.
- class pyface.ui_traits.Margin(*args, **traits)[source]¶
Bases:
BaseMBA HasTraits class that holds margin sizes.
- top = Range(-32, 32, 0)¶
The amount of padding/margin at the top.
- bottom = Range(-32, 32, 0)¶
The amount of padding/margin at the bottom.
- left = Range(-32, 32, 0)¶
The amount of padding/margin on the left.
- right = Range(-32, 32, 0)¶
The amount of padding/margin on the right.
- class pyface.ui_traits.Border(*args, **traits)[source]¶
Bases:
BaseMBA HasTraits class that holds border thicknesses.
- top = Range(0, 32, 0)¶
The amount of border at the top.
- bottom = Range(0, 32, 0)¶
The amount of border at the bottom.
- left = Range(0, 32, 0)¶
The amount of border on the left.
- right = Range(0, 32, 0)¶
The amount of border on the right.
- class pyface.ui_traits.HasMargin(default_value=<traits.trait_type._NoDefaultSpecifiedType object>, **metadata)[source]¶
Bases:
TraitTypeDefines a trait whose value must be a Margin object or an integer or tuple value that can be converted to one.
- default_value = <pyface.ui_traits.Margin object>¶
Define the default value for the trait.
- info_text = 'a Margin instance, or an integer in the range from -32 to 32 or a tuple with 1, 2 or 4 integers in that range that can be used to define one'¶
A description of the type of value this trait accepts.
- class pyface.ui_traits.HasBorder(default_value=<traits.trait_type._NoDefaultSpecifiedType object>, **metadata)[source]¶
Bases:
HasMarginDefines a trait whose value must be a Border object or an integer or tuple value that can be converted to one.
- default_value = <pyface.ui_traits.Border object>¶
Define the default value for the trait.
- info_text = 'a Border instance, or an integer in the range from 0 to 32 or a tuple with 1, 2 or 4 integers in that range that can be used to define one'¶
A description of the type of value this trait accepts.
- pyface.ui_traits.Position = Enum("left", "right", "above", "below")¶
The position of an image relative to its associated text.
- pyface.ui_traits.Alignment = Enum("default", "left", "center", "right")¶
The alignment of text within a control.
- pyface.ui_traits.Orientation = Enum("vertical", "horizontal")¶
Whether the orientation of a widget’s contents is horizontal or vertical.