virtual_knitting_machine.visualizer.visualizer_elements.diagram_elements.yarn_inserting_hook_block module
Module containing the Yarn Inserting Hook Block class.
- class Yarn_Inserting_Hook_Block(rendered_sliders, hook_index, hooked_carrier, needle_count_on_bed, diagram_settings, **shape_kwargs)[source]
Bases:
Rect_ElementA black box aligned with the middle of the needle beds used to show the range of needles blocked by the yarn-inserting hook.
- __init__(rendered_sliders, hook_index, hooked_carrier, needle_count_on_bed, diagram_settings, **shape_kwargs)[source]
- Parameters:
rendered_sliders (bool) – True if the diagram has rendered slider beds to orient the block around.
hook_index (int) – The index of the yarn-inserting hook.
needle_count_on_bed (int) – The number of needles rendered on the needle bed.
diagram_settings (Diagram_Settings) – The diagram settings object used to render the diagram.
**shape_kwargs (Any) – Additional keyword arguments used to render the block.
- 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)