How to use the enable.api.ColorTrait function in enable

To help you get started, we’ve selected a few enable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github enthought / chaco / chaco / chaco_plot_editor.py View on Github external
# Color of the label of the x-axis.
    x_label_color = black_color_trait
    # Label of the y-axis; if None, the **value** name is used.
    y_label = Trait(None, None, Str)
    # Name of the trait on the object containing the label of the y-axis.
    # This takes precedence over **y_label**.
    y_label_trait = Trait(None, None, Str)
    # Font for the label of the y-axis.
    y_label_font = KivaFont("modern 10")
    # Color of the label of the y-axis.
    y_label_color = black_color_trait

    # General plot properties

    # Foreground olor of the plot.
    color = ColorTrait("blue")
    # Background color of the plot.
    bgcolor = white_color_trait
    # Background color of the plot (deprecated).
    bg_color = Property   # backwards compatibility; deprecated
    # Color of the background padding.
    padding_bg_color = ColorTrait("sys_window")

    # Border properties

    # Width of the plot border
    border_width = Int(1)
    # Is the border visible?
    border_visible = Bool(False)
    # Line style of the border.
    border_dash = LineStyle
    # Color of the border.
github enthought / chaco / chaco / segment_plot.py View on Github external
#: The data to use for segment width.  Used only when self.width_by_data
    #: is True.
    width_data = Instance(AbstractDataSource, redraw=True)

    #: Whether to draw segments using a constant width or mapped width.
    width_mapper = Instance(AbstractMapper, redraw=True)

    #: Whether or not to shade selected segments.
    show_selection = True

    #: the plot data metadata name to watch for selection information
    selection_metadata_name = Str("selections")

    #: The color to use for selected segments.  Not used if color by data.
    selection_color = ColorTrait('yellow')

    #: The alpha fade to use for non-selected segments.
    selection_alpha = Float(0.3)

    #: The width multiple to use for non-selected segments.
    selection_width = Float(1.0)

    #: RGBA values for rendering individual segments, in the case where
    #: color_by_data is True.  This is a length N array with the rgba_dtype
    #: and are computed using the current color or color mapper and color_data,
    #: with the global 'alpha' mixed in.
    effective_colors = Property(
        Array,
        depends_on=[
            'color_by_data', 'alpha', 'color_mapper.updated',
            'color_data.data_changed', 'alpha', 'selection_mask',
github enthought / chaco / chaco / axis.py View on Github external
title = Trait('', Str, Unicode) #May want to add PlotLabel option

    # The font of the title.
    title_font = KivaFont('modern 12')

    # The spacing between the axis line and the title
    title_spacing = Trait('auto', 'auto', Float)

    # The color of the title.
    title_color = ColorTrait("black")

    # The thickness (in pixels) of each tick.
    tick_weight = Float(1.0)

    # The color of the ticks.
    tick_color = ColorTrait("black")

    # The font of the tick labels.
    tick_label_font = KivaFont('modern 10')

    # The color of the tick labels.
    tick_label_color = ColorTrait("black")

    # The rotation of the tick labels.
    tick_label_rotate_angle = Float(0)

    # Whether to align to corners or edges (corner is better for 45 degree rotation)
    tick_label_alignment = Enum('edge', 'corner')

    # The margin around the tick labels.
    tick_label_margin = Int(2)
github enthought / chaco / chaco / chaco_plot_editor.py View on Github external
y_label_trait = Trait(None, None, Str)
    # Font for the label of the y-axis.
    y_label_font = KivaFont("modern 10")
    # Color of the label of the y-axis.
    y_label_color = black_color_trait

    # General plot properties

    # Foreground olor of the plot.
    color = ColorTrait("blue")
    # Background color of the plot.
    bgcolor = white_color_trait
    # Background color of the plot (deprecated).
    bg_color = Property   # backwards compatibility; deprecated
    # Color of the background padding.
    padding_bg_color = ColorTrait("sys_window")

    # Border properties

    # Width of the plot border
    border_width = Int(1)
    # Is the border visible?
    border_visible = Bool(False)
    # Line style of the border.
    border_dash = LineStyle
    # Color of the border.
    border_color = black_color_trait

    # The type of the plot.
    type = Enum("line", "scatter")
    # The type of the plot as a string.
    type_trait = Str
github enthought / chaco / chaco / axis.py View on Github external
title_spacing = Trait('auto', 'auto', Float)

    # The color of the title.
    title_color = ColorTrait("black")

    # The thickness (in pixels) of each tick.
    tick_weight = Float(1.0)

    # The color of the ticks.
    tick_color = ColorTrait("black")

    # The font of the tick labels.
    tick_label_font = KivaFont('modern 10')

    # The color of the tick labels.
    tick_label_color = ColorTrait("black")

    # The rotation of the tick labels.
    tick_label_rotate_angle = Float(0)

    # Whether to align to corners or edges (corner is better for 45 degree rotation)
    tick_label_alignment = Enum('edge', 'corner')

    # The margin around the tick labels.
    tick_label_margin = Int(2)

    # The distance of the tick label from the axis.
    tick_label_offset = Float(8.)

    # Whether the tick labels appear to the inside or the outside of the plot area
    tick_label_position = Enum("outside", "inside")
github enthought / chaco / chaco / text_box_overlay.py View on Github external
#### Configuration traits #################################################

    # The text to display in the box.
    text = Str

    # The font to use for the text.
    font = KivaFont("modern 12")

    # The background color for the box (overrides AbstractOverlay).
    bgcolor = ColorTrait("transparent")

    # The alpha value to apply to **bgcolor**
    alpha = Trait(1.0, None, Float)

    # The color of the outside box.
    border_color = ColorTrait("dodgerblue")

    # The color of the text.
    text_color = ColorTrait("black")

    # The thickness of box border.
    border_size = Int(1)

    # The border visibility. Defaults to true to duplicate previous behavior.
    border_visible = Bool(True)

    # Number of pixels of padding around the text within the box.
    padding = Int(5)

    # The maximum width of the displayed text. This affects the width of the
    # text only, not the text box, which includes margins around the text and
    # `padding`.
github enthought / enable / enable / tools / toolbars / toolbar_buttons.py View on Github external
down_color = ColorTrait("gray")

    border_color = ColorTrait((0.4, 0.4, 0.4, 1.0))

    # important for rendering rounded buttons properly, since the default for
    # the Component parent class is 'white'
    bgcolor = "clear"

    label = Str

    label_font = KivaFont("modern 11 bold")

    label_color = ColorTrait("white")

    label_shadow = ColorTrait("gray")

    shadow_text = Bool(True)

    label_padding = Int(5)

    height = Int(20)

    button_state = Enum("up", "down")

    end_radius = Int(10)

    # Default size of the button if no label is present
    bounds=[32,32]

    # Cached value of the measured sizes of self.label
    _text_extents = Tuple
github enthought / chaco / examples / demo / canvas / axis_tool.py View on Github external
class AxisTool(BaseTool):

    # The object to notify when we've been clicked
    # We notify by calling its .notify method, which should have the
    # signature:
    #     should_handle_event = notify(axis_tool, axis, down_or_up, event)
    #
    # It should return a bool indicating whether or not we should process the
    # event.
    range_controller = Any

    down_tick_color = ColorTrait("red")
    down_axis_line_color = ColorTrait("red")
    down_tick_label_color = ColorTrait("red")
    down_bgcolor = ColorTrait("lightgray")
    down_border_visible = Bool(True)
    down_border_color = Trait(None, None, ColorTrait)

    _cached_tick_color = ColorTrait
    _cached_axis_line_color = ColorTrait
    _cached_tick_labl_color = ColorTrait
    _cached_bgcolor = ColorTrait
    _cached_border_visible = Bool(True)
    _cached_border_color = ColorTrait

    attr_list = ("tick_color", "axis_line_color", "tick_label_color", "bgcolor",
                 "border_visible", "border_color")

    def normal_left_down(self, event):
        if self.component is None:
github OpenModelica / OMPython / PythonInterface / PySimulator / Plugins / Analysis / EigenvalueAnalysis / scatterInspector.py View on Github external
"""
    
    # The style to use when a point is hovered over
    hover_metadata_name = Str('hover')
    hover_marker = Trait(None, None, MarkerTrait)
    hover_marker_size = Trait(None, None, Int)
    hover_line_width = Trait(None, None, Float)
    hover_color = Trait(None, None, ColorTrait)
    hover_outline_color = Trait(None, None, ColorTrait)

    # The style to use when a point has been selected by a click
    selection_metadata_name = Str('selections')
    selection_marker = Trait(None, None, MarkerTrait)
    selection_marker_size = Trait(None, None, Int)
    selection_line_width = Trait(None, None, Float)
    selection_color = Trait(None, None, ColorTrait)
    selection_outline_color = Trait(None, None, ColorTrait)
    
    stateNames = []
    eigenVectors = None
    
    frequencies = None
    damping = None
    observability = None
    controllability = None
    
    
    label = None    #Label with information
    hasOverlay = []
    labelIndex = [] #index where the label is actually
    oldIndex = array([])
    # For now, implement the equivalent of this Traits 3 feature manually
github enthought / chaco / examples / tutorials / scipy2008 / custom_overlay_movetool.py View on Github external
from enthought.chaco.api import ArrayPlotData, Plot, AbstractOverlay
from enthought.chaco.tools.api import PanTool, MoveTool
from enable.component_editor import ComponentEditor
from enable.api import ColorTrait
from traits.api import Button, CArray, Bool, Float, Range, \
                                 HasTraits, Instance, Property
from traitsui.api import Item, View, Group, RangeEditor, \
                                    HGroup, Handler, spring

class CustomOverlay(AbstractOverlay):
    x = Float(10, editor=RangeEditor(low=1.0, high=600, mode="slider"))
    y = Float(10, editor=RangeEditor(low=1.0, high=500, mode="slider"))
    width = Range(10.0, 300, editor=RangeEditor(low=10.0, high=300, mode="slider"))
    height = Range(10.0, 300, editor=RangeEditor(low=10.0, high=300, mode="slider"))
    color = ColorTrait("red")
    dataspace = Bool(False)
    position = Property

    _anchor = CArray

    traits_view = View(Group(
                        Item("x"), Item("y"), Item("width"), Item("height"),
                        Item("color"),
                        Item("dataspace", label="Data space?"),
                        orientation = "vertical"
                        ))

    def overlay(self, component, gc, view_bounds=None, mode="normal"):
        if self.dataspace:
            self.x, self.y = component.map_screen(self._anchor)
        gc.set_fill_color(self.color_)