virtual_knitting_machine.visualizer.visualizer_elements.diagram_elements.carrier_legend module
Module containing the Carrier_Legend class
- class Carrier_Legend(x, y, diagram_settings, carriers)[source]
Bases:
Visualizer_Group- width()[source]
- Returns:
The width of the carrier legend based on the width of the labels.
- Return type:
- height()[source]
- Returns:
The total height of the carrier legend based on the height of the labels.
- Return type:
- __contains__(element_id)
- __getitem__(element_id)
- add_child(child)
Add the given child element as a sub element to this element. :param child: The child element to add. :type child: Visualizer_Element
- add_to_drawing(drawing)
Adds this element to the given svg drawing. :param drawing: The drawing to add. :type drawing: Drawing
- static darken_color(color='none', factor=0.7)
Darken a hex or named color.
- Parameters:
- Returns:
The color-string of the darkened color. If “none” color is given, this will return “black”.
- Return type:
- static fill_from_stroke(stroke, lighten_factor=0.3)
- property global_x: float
Returns: float: The global x coordinate of this element based on its parent’s coordinates.
- global_x_position(x)
- property global_y: float
Returns: float: The global y coordinate of this element based on its parent’s coordinates.
- global_y_position(y)
- static lighten_color(color='none', factor=0.3)
Lighten a hex or named color.
- Parameters:
- Returns:
The color-string of the lightened color. If “none” color is given, this will return “black”.
- Return type:
- property name: str
Returns: str: The unique name of this element. This will match the id of the svg element being wrapped.
- static stroke_from_fill(fill, darken_factor=0.7)