virtual_knitting_machine.visualizer.visualizer_elements.visualizer_group module
Module containing the Visualizer_Group class.
- class Visualizer_Group(x, y, name)[source]
Bases:
Visualizer_ElementA wrapper for SVG Groups. The coordinate position of the group is used to set each of its children to a relative position.
- children
A list of Visualizer_Element objects that are children of the group.
- Type:
- add_child(child)[source]
Add the given child element as a sub element to this element. :param child: The child element to add. :type child: Visualizer_Element
- __getitem__(element_id)[source]
- 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)