drawsvg API Reference
Python library for programmatic generation and rendering of SVG files.
drawsvg.Animate
Python Library Documentation: class Animate in module drawsvg.elements class Animate(drawsvg.types.DrawingBasicElement) | Animate(attributeName, dur, from_or_values=None, to=None, begin=None, other_elem=None, **kwargs) | | Animation for a specific property of another element. | | This should be added as a child of the element to animate. Otherwise the | referenced other element and this element must both be added to the drawing. | | Useful SVG attributes: | - repeatCount: 0, 1, ..., 'indefinite' | | Method resolution order: | Animate | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, attributeName, dur, from_or_values=None, to=None, begin=None, other_elem=None, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | get_linked_elems(self) | | get_svg_defs(self) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | TAG_NAME = 'animate' | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | has_content = False | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.AnimateMotion
Python Library Documentation: class AnimateMotion in module drawsvg.elements class AnimateMotion(Animate) | AnimateMotion(path, dur, from_or_values=None, to=None, begin=None, other_elem=None, **kwargs) | | Animation for the motion of another element along a path. | | This should be added as a child of the element to animate. Otherwise the | referenced other element and this element must both be added to the drawing. | | Method resolution order: | AnimateMotion | Animate | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, path, dur, from_or_values=None, to=None, begin=None, other_elem=None, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | TAG_NAME = 'animateMotion' | | ---------------------------------------------------------------------- | Methods inherited from Animate: | | get_linked_elems(self) | | get_svg_defs(self) | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | has_content = False | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.AnimateTransform
Python Library Documentation: class AnimateTransform in module drawsvg.elements class AnimateTransform(Animate) | AnimateTransform(type, dur, from_or_values, to=None, begin=None, attributeName='transform', other_elem=None, **kwargs) | | Animation for the transform property of another element. | | This should be added as a child of the element to animate. Otherwise the | referenced other element and this element must both be added to the drawing. | | Method resolution order: | AnimateTransform | Animate | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, type, dur, from_or_values, to=None, begin=None, attributeName='transform', other_elem=None, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | TAG_NAME = 'animateTransform' | | ---------------------------------------------------------------------- | Methods inherited from Animate: | | get_linked_elems(self) | | get_svg_defs(self) | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | has_content = False | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.Arc
Python Library Documentation: class Arc in module drawsvg.elements class Arc(Path) | Arc(cx, cy, r, start_deg, end_deg, cw=False, **kwargs) | | A circular arc. | | Additional keyword arguments are output as additional arguments to the SVG | node e.g. fill="red", stroke="#ff4477", stroke_width=2. | | Method resolution order: | Arc | Path | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, cx, cy, r, start_deg, end_deg, cw=False, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from Path: | | A(self, rx, ry, rot, large_arc, sweep, ex, ey) | Draw a circular or elliptical arc. | | See | https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#elliptical_arc_curve | | C(self, cx1, cy1, cx2, cy2, ex, ey) | Draw a cubic Bezier curve. | | H(self, x) | Draw a horizontal line to this x coordinate. | | L(self, x, y) | Draw a line to this point. | | M(self, x, y) | Start a new curve section from this point. | | Q(self, cx, cy, ex, ey) | Draw a quadratic Bezier curve. | | S(self, cx2, cy2, ex, ey) | Draw a cubic Bezier curve, transitioning smoothly from the previous. | | T(self, ex, ey) | Draw a quadratic Bezier curve, transitioning soothly from the | previous. | | V(self, y) | Draw a horizontal line to this y coordinate. | | Z(self) | Draw a line back to the previous m or M point. | | a(self, rx, ry, rot, large_arc, sweep, ex, ey) | Draw a circular or elliptical arc (relative coordinates). | | See | https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#elliptical_arc_curve | | append(self, command_str, *args) | | arc(self, cx, cy, r, start_deg, end_deg, cw=True, include_m=True, include_l=False) | Draw a circular arc, controlled by center, radius, and start/end | degrees. | | Angles rotate from the x-axis towards the positive y-axis. | | c(self, cx1, cy1, cx2, cy2, ex, ey) | Draw a cubic Bezier curve (relative coordinates). | | h(self, dx) | Draw a horizontal line to this relative x coordinate. | | l(self, dx, dy) | Draw a line to this point (relative coordinates). | | m(self, dx, dy) | Start a new curve section from this point (relative coordinates). | | q(self, cx, cy, ex, ey) | Draw a quadratic Bezier curve (relative coordinates). | | s(self, cx2, cy2, ex, ey) | Draw a cubic Bezier curve, transitioning smoothly from the previous | (relative coordinates). | | t(self, ex, ey) | Draw a quadratic Bezier curve, transitioning soothly from the | previous (relative coordinates). | | v(self, dy) | Draw a horizontal line to this relative y coordinate. | | ---------------------------------------------------------------------- | Data and other attributes inherited from Path: | | TAG_NAME = 'path' | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | get_svg_defs(self) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | has_content = False | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.ArcLine
Python Library Documentation: class ArcLine in module drawsvg.elements class ArcLine(Circle) | ArcLine(cx, cy, r, start_deg, end_deg, **kwargs) | | An arc. | | In most cases, use Arc instead of ArcLine. ArcLine uses the | stroke-dasharray SVG property to make the edge of a circle look like an arc. | | Additional keyword arguments are output as additional arguments to the SVG | node e.g. fill="red", stroke="#ff4477", stroke_width=2. | | Method resolution order: | ArcLine | Circle | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, cx, cy, r, start_deg, end_deg, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes inherited from Circle: | | TAG_NAME = 'circle' | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | get_svg_defs(self) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | has_content = False | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.Circle
Python Library Documentation: class Circle in module drawsvg.elements class Circle(drawsvg.types.DrawingBasicElement) | Circle(cx, cy, r, **kwargs) | | A circle. | | Additional keyword arguments are output as additional arguments to the SVG | node e.g. fill="red", stroke="#ff4477", stroke_width=2. | | Method resolution order: | Circle | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, cx, cy, r, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | TAG_NAME = 'circle' | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | get_svg_defs(self) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | has_content = False | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.ClipPath
Python Library Documentation: class ClipPath in module drawsvg.defs class ClipPath(DrawingDef) | ClipPath(children=(), ordered_children=None, **args) | | A shape used to crop another element by not drawing outside of this shape. | | Has regular drawing elements as children. | | Method resolution order: | ClipPath | DrawingDef | drawsvg.types.DrawingParentElement | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Data and other attributes defined here: | | TAG_NAME = 'clipPath' | | ---------------------------------------------------------------------- | Methods inherited from DrawingDef: | | get_svg_defs(self) | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingParentElement: | | __init__(self, children=(), ordered_children=None, **args) | Initialize self. See help(type(self)) for accurate signature. | | append(self, element, *, z=None) | | draw(self, obj, *, z=None, **kwargs) | | extend(self, iterable, *, z=None) | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingParentElement: | | has_content = True | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.Context
Python Library Documentation: class Context in module drawsvg.types
class Context(builtins.object)
| Context(invert_y: bool = False, animation_config: Optional[drawsvg.native_animation.synced_animation.SyncedAnimationConfig] = None) -> None
|
| Additional drawing configuration that can modify element's SVG output.
|
| Methods defined here:
|
| __delattr__(self, name)
| Implement delattr(self, name).
|
| __eq__(self, other)
| Return self==value.
|
| __hash__(self)
| Return hash(self).
|
| __init__(self, invert_y: bool = False, animation_config: Optional[drawsvg.native_animation.synced_animation.SyncedAnimationConfig] = None) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| __setattr__(self, name, value)
| Implement setattr(self, name, value).
|
| extra_css(self, d)
|
| extra_javascript(self, d)
|
| extra_onload_js(self, d)
|
| extra_prepost_drawing_elements(self, d)
|
| is_attr_inverted(self, name)
|
| override_args(self, args)
|
| override_view_box(self, view_box)
|
| write_svg_document_args(self, d, args, output_file)
| Called by Drawing during SVG output of the <svg> tag.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'animation_config': typing.Optional[drawsvg.native_...
|
| __dataclass_fields__ = {'animation_config': Field(name='animation_conf...
|
| __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,or...
|
| __match_args__ = ('invert_y', 'animation_config')
|
| animation_config = None
|
| invert_y = False
drawsvg.Discard
Python Library Documentation: class Discard in module drawsvg.elements class Discard(Animate) | Discard(attributeName, begin=None, **kwargs) | | Animation configuration specifying when it is safe to discard another | element. | | Use this when an element will no longer be visible after an animation. | This should be added as a child of the element to animate. Otherwise the | referenced other element and this element must both be added to the drawing. | | Method resolution order: | Discard | Animate | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, attributeName, begin=None, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | TAG_NAME = 'discard' | | ---------------------------------------------------------------------- | Methods inherited from Animate: | | get_linked_elems(self) | | get_svg_defs(self) | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | has_content = False | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.Drawing
Python Library Documentation: class Drawing in module drawsvg.drawing class Drawing(builtins.object) | Drawing(width, height, origin=(0, 0), context: drawsvg.types.Context = None, animation_config=None, id_prefix='d', **svg_args) | | A vector drawing. | | Append shapes and other elements with `.append()`. The default coordinate | system origin is at the top-left corner with x-values increasing to the | right and y-values increasing downward. | | Supports Jupyter: If a Drawing is the last line of a cell, it will be | displayed as an SVG below. | | Methods defined here: | | __init__(self, width, height, origin=(0, 0), context: drawsvg.types.Context = None, animation_config=None, id_prefix='d', **svg_args) | Initialize self. See help(type(self)) for accurate signature. | | all_css(self, context=None) | | all_elements(self, context=None) | Return self.elements, self.ordered_elements, and extras as a single | list. | | all_javascript(self, context=None) | | append(self, element, *, z=None) | Add any `DrawingElement` to the drawing. | | Do not append a `DrawingDef` referenced by other elements. These are | included automatically. Use `.append_def()` for an unreferenced | `DrawingDef`. | | append_css(self, css_text) | | append_def(self, element) | | append_javascript(self, js_text, onload=None) | | append_title(self, text, **kwargs) | | as_animation_frames(self, fps=10, duration=None, context=None) | Returns a list of synced animation frames that can be converted to a | video. | | as_gif(self, to_file=None, fps=10, duration=None, context=None, verbose=False) | | as_html(self, output_file=None, title=None, randomize_ids=False, context=None, fix_embed_iframe=False) | | as_mp4(self, to_file=None, fps=10, duration=None, context=None, verbose=False) | | as_spritesheet(self, to_file=None, fps=10, duration=None, context=None, row_length=None, verbose=False) | | as_svg(self, output_file=None, randomize_ids=False, header='<?xml version="1.0" encoding="UTF-8"?>\n', skip_js=False, skip_css=False, context=None) | | as_video(self, to_file=None, fps=10, duration=None, mime_type=None, file_type=None, context=None, verbose=False) | | calc_render_size(self) | | clear(self) | Clears all drawing elements, with or without a z-index, but keeps | defs-type elements added with `append_def()`. | | count(self, element) | Counts the number of top-level elements (except those with a z-index | ). | | display_iframe(self, context=None) | Display within an iframe the Jupyter web page. | | display_image(self, context=None) | Display within an img in the Jupyter web page. | | display_inline(self, context=None) | Display inline in the Jupyter web page. | | draw(self, obj, *, z=None, **kwargs) | Add any object that knows how to draw itself to the drawing. | | This object must implement the `to_drawables(**kwargs)` method | that returns a `DrawingElement` or list of elements. | | draw_def(self, obj, **kwargs) | | embed_google_font(self, family, text=None, display='swap', **kwargs) | Download SVG-embeddable CSS from Google fonts. | | Args: | family: Name of font family or list of font families. | text: The set of characters required from the font. Only a font | subset with these characters will be downloaded. | display: The font-display CSS value. | **kwargs: Other URL parameters sent to | https://fonts.googleapis.com/css?... | | extend(self, iterable, *, z=None) | | index(self, *args, **kwargs) | Finds the array-index of a top-level element (except those with a | z-index). | | insert(self, i, element) | Inserts a top-level element at the given array index. | | rasterize(self, to_file=None, context=None) | | remove(self, element) | Removes a top-level element (except those with a z-index). | | reverse(self) | Reverses the order of all elements (except those with a z-index). | | save_gif(self, fname, fps=10, duration=None, context=None, verbose=False) | | save_html(self, fname, title=None, encoding='utf-8', context=None) | | save_mp4(self, fname, fps=10, duration=None, context=None, verbose=False) | | save_png(self, fname, context=None) | | save_spritesheet(self, fname, fps=10, duration=None, context=None, row_length=None, verbose=False) | | save_svg(self, fname, encoding='utf-8', context=None) | | save_video(self, fname, fps=10, duration=None, mime_type=None, file_type=None, context=None, verbose=False) | | set_pixel_scale(self, s=1) | | set_render_size(self, w=None, h=None) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.DrawingBasicElement
Python Library Documentation: class DrawingBasicElement in module drawsvg.types class DrawingBasicElement(DrawingElement) | DrawingBasicElement(**args) | | Base class for SVG drawing elements that are a single node with no child | nodes. | | Method resolution order: | DrawingBasicElement | DrawingElement | builtins.object | | Methods defined here: | | __eq__(self, other) | Return self==value. | | __init__(self, **args) | Initialize self. See help(type(self)) for accurate signature. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | get_svg_defs(self) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties defined here: | | id | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | TAG_NAME = '_' | | __hash__ = None | | has_content = False | | ---------------------------------------------------------------------- | Methods inherited from DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.DrawingDef
Python Library Documentation: class DrawingDef in module drawsvg.defs class DrawingDef(drawsvg.types.DrawingParentElement) | DrawingDef(children=(), ordered_children=None, **args) | | Parent class of SVG nodes that must be direct children of <defs>. | | Method resolution order: | DrawingDef | drawsvg.types.DrawingParentElement | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | get_svg_defs(self) | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingParentElement: | | __init__(self, children=(), ordered_children=None, **args) | Initialize self. See help(type(self)) for accurate signature. | | append(self, element, *, z=None) | | draw(self, obj, *, z=None, **kwargs) | | extend(self, iterable, *, z=None) | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingParentElement: | | has_content = True | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | TAG_NAME = '_' | | __hash__ = None | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.DrawingDefSub
Python Library Documentation: class DrawingDefSub in module drawsvg.defs class DrawingDefSub(drawsvg.types.DrawingParentElement) | DrawingDefSub(children=(), ordered_children=None, **args) | | Parent class of SVG nodes that are meant to be descendants of a Def. | | Method resolution order: | DrawingDefSub | drawsvg.types.DrawingParentElement | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods inherited from drawsvg.types.DrawingParentElement: | | __init__(self, children=(), ordered_children=None, **args) | Initialize self. See help(type(self)) for accurate signature. | | append(self, element, *, z=None) | | draw(self, obj, *, z=None, **kwargs) | | extend(self, iterable, *, z=None) | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingParentElement: | | has_content = True | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | get_svg_defs(self) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | TAG_NAME = '_' | | __hash__ = None | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.DrawingElement
Python Library Documentation: class DrawingElement in module drawsvg.types class DrawingElement(builtins.object) | Base class for drawing elements. | | Subclasses must implement write_svg_element. | | Methods defined here: | | __eq__(self, other) | Return self==value. | | get_linked_elems(self) | | get_svg_defs(self) | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __hash__ = None
drawsvg.DrawingParentElement
Python Library Documentation: class DrawingParentElement in module drawsvg.types class DrawingParentElement(DrawingBasicElement) | DrawingParentElement(children=(), ordered_children=None, **args) | | Base class for SVG elements that can have child nodes. | | Method resolution order: | DrawingParentElement | DrawingBasicElement | DrawingElement | builtins.object | | Methods defined here: | | __init__(self, children=(), ordered_children=None, **args) | Initialize self. See help(type(self)) for accurate signature. | | append(self, element, *, z=None) | | draw(self, obj, *, z=None, **kwargs) | | extend(self, iterable, *, z=None) | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | has_content = True | | ---------------------------------------------------------------------- | Methods inherited from DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | get_svg_defs(self) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from DrawingBasicElement: | | TAG_NAME = '_' | | __hash__ = None | | ---------------------------------------------------------------------- | Methods inherited from DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.Ellipse
Python Library Documentation: class Ellipse in module drawsvg.elements class Ellipse(drawsvg.types.DrawingBasicElement) | Ellipse(cx, cy, rx, ry, **kwargs) | | An ellipse. | | Additional keyword arguments are output as additional arguments to the SVG | node e.g. fill="red", stroke="#ff4477", stroke_width=2. | | Method resolution order: | Ellipse | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, cx, cy, rx, ry, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | TAG_NAME = 'ellipse' | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | get_svg_defs(self) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | has_content = False | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.Filter
Python Library Documentation: class Filter in module drawsvg.defs class Filter(DrawingDef) | Filter(children=(), ordered_children=None, **args) | | A filter to apply to geometry. | | For example a blur filter. | | Method resolution order: | Filter | DrawingDef | drawsvg.types.DrawingParentElement | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Data and other attributes defined here: | | TAG_NAME = 'filter' | | ---------------------------------------------------------------------- | Methods inherited from DrawingDef: | | get_svg_defs(self) | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingParentElement: | | __init__(self, children=(), ordered_children=None, **args) | Initialize self. See help(type(self)) for accurate signature. | | append(self, element, *, z=None) | | draw(self, obj, *, z=None, **kwargs) | | extend(self, iterable, *, z=None) | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingParentElement: | | has_content = True | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.FilterItem
Python Library Documentation: class FilterItem in module drawsvg.defs class FilterItem(DrawingDefSub) | FilterItem(tag_name, **args) | | A child of Filter with any tag name. | | Method resolution order: | FilterItem | DrawingDefSub | drawsvg.types.DrawingParentElement | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, tag_name, **args) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingParentElement: | | append(self, element, *, z=None) | | draw(self, obj, *, z=None, **kwargs) | | extend(self, iterable, *, z=None) | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingParentElement: | | has_content = True | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | get_svg_defs(self) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | TAG_NAME = '_' | | __hash__ = None | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.ForeignObject
Python Library Documentation: class ForeignObject in module drawsvg.elements class ForeignObject(drawsvg.types.DrawingBasicElement) | ForeignObject(content, **kwargs) | | A foreign object, i.e. for embedding HTML. | | In the context of SVG embedded in an HTML document, the XHTML namespace | could be omitted in the foreignObject content, but it is mandatory in the | context of an SVG document. | | This element works best when viewing the SVG in a browser. Drawing.rasterize() | and Drawing.save_png() are unable to display this element. | | Additional keyword arguments are output as additional arguments to the SVG | node e.g. fill="red", stroke="#ff4477", stroke_width=2. | | Method resolution order: | ForeignObject | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, content, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | TAG_NAME = 'foreignObject' | | has_content = True | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | get_svg_defs(self) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.FrameAnimation
Python Library Documentation: class FrameAnimation in module drawsvg.frame_animation class FrameAnimation(builtins.object) | FrameAnimation(draw_func=None, callback=None) | | Methods defined here: | | __init__(self, draw_func=None, callback=None) | Initialize self. See help(type(self)) for accurate signature. | | append_frame(self, frame) | | draw_frame(self, *args, **kwargs) | | save_spritesheet(self, file, **kwargs) | | save_video(self, file, **kwargs) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.GradientStop
Python Library Documentation: class GradientStop in module drawsvg.defs class GradientStop(DrawingDefSub) | GradientStop(children=(), ordered_children=None, **args) | | A control point for a radial or linear gradient. | | Method resolution order: | GradientStop | DrawingDefSub | drawsvg.types.DrawingParentElement | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Data and other attributes defined here: | | TAG_NAME = 'stop' | | has_content = False | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingParentElement: | | __init__(self, children=(), ordered_children=None, **args) | Initialize self. See help(type(self)) for accurate signature. | | append(self, element, *, z=None) | | draw(self, obj, *, z=None, **kwargs) | | extend(self, iterable, *, z=None) | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | get_svg_defs(self) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.Group
Python Library Documentation: class Group in module drawsvg.elements class Group(drawsvg.types.DrawingParentElement) | Group(children=(), ordered_children=None, **args) | | A group of drawing elements. | | Any transform will apply to its children and other attributes will be | inherited by its children. | | Method resolution order: | Group | drawsvg.types.DrawingParentElement | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Data and other attributes defined here: | | TAG_NAME = 'g' | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingParentElement: | | __init__(self, children=(), ordered_children=None, **args) | Initialize self. See help(type(self)) for accurate signature. | | append(self, element, *, z=None) | | draw(self, obj, *, z=None, **kwargs) | | extend(self, iterable, *, z=None) | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingParentElement: | | has_content = True | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | get_svg_defs(self) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.Image
Python Library Documentation: class Image in module drawsvg.elements
class Image(drawsvg.types.DrawingBasicElement)
| Image(x, y, width, height, path=None, data=None, embed=False, mime_type=None, **kwargs)
|
| A linked or embedded image.
|
| Method resolution order:
| Image
| drawsvg.types.DrawingBasicElement
| drawsvg.types.DrawingElement
| builtins.object
|
| Methods defined here:
|
| __init__(self, x, y, width, height, path=None, data=None, embed=False, mime_type=None, **kwargs)
| Specify either the path or data argument. If path is used and embed is
| True, the image file is embedded in a data URI.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| MIME_DEFAULT = 'image/png'
|
| MIME_MAP = {'.bm': 'image/bmp', '.bmp': 'image/bmp', '.gif': 'image/gi...
|
| TAG_NAME = 'image'
|
| ----------------------------------------------------------------------
| Methods inherited from drawsvg.types.DrawingBasicElement:
|
| __eq__(self, other)
| Return self==value.
|
| add_attribute_key_sequence(self, attr, times, values, *, animation_args=None)
|
| add_key_frame(self, time, animation_args=None, **attr_values)
|
| all_children(self, lcontext=None)
| Return self.children and self.ordered_children as a single list.
|
| append_anim(self, animate_element)
|
| append_title(self, text, **kwargs)
|
| check_children_allowed(self)
|
| extend_anim(self, animate_iterable)
|
| extra_children_with_context(self, lcontext=None)
|
| get_svg_defs(self)
|
| write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run)
| Override in a subclass to add data between the start and end tags.
|
| This will not be called if has_content is False.
|
| write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run)
| Override in a subclass to add data between the start and end tags.
|
| This will not be called if has_content is False.
|
| write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run)
|
| write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False)
|
| ----------------------------------------------------------------------
| Readonly properties inherited from drawsvg.types.DrawingBasicElement:
|
| id
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from drawsvg.types.DrawingBasicElement:
|
| __hash__ = None
|
| has_content = False
|
| ----------------------------------------------------------------------
| Methods inherited from drawsvg.types.DrawingElement:
|
| get_linked_elems(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from drawsvg.types.DrawingElement:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
drawsvg.Line
Python Library Documentation: class Line in module drawsvg.elements class Line(Lines) | Line(sx, sy, ex, ey, **kwargs) | | A simple line. | | Additional keyword arguments are output as additional arguments to the SVG | node e.g. fill="red", stroke="#ff4477", stroke_width=2. | | Method resolution order: | Line | Lines | Path | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, sx, sy, ex, ey, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from Path: | | A(self, rx, ry, rot, large_arc, sweep, ex, ey) | Draw a circular or elliptical arc. | | See | https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#elliptical_arc_curve | | C(self, cx1, cy1, cx2, cy2, ex, ey) | Draw a cubic Bezier curve. | | H(self, x) | Draw a horizontal line to this x coordinate. | | L(self, x, y) | Draw a line to this point. | | M(self, x, y) | Start a new curve section from this point. | | Q(self, cx, cy, ex, ey) | Draw a quadratic Bezier curve. | | S(self, cx2, cy2, ex, ey) | Draw a cubic Bezier curve, transitioning smoothly from the previous. | | T(self, ex, ey) | Draw a quadratic Bezier curve, transitioning soothly from the | previous. | | V(self, y) | Draw a horizontal line to this y coordinate. | | Z(self) | Draw a line back to the previous m or M point. | | a(self, rx, ry, rot, large_arc, sweep, ex, ey) | Draw a circular or elliptical arc (relative coordinates). | | See | https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#elliptical_arc_curve | | append(self, command_str, *args) | | arc(self, cx, cy, r, start_deg, end_deg, cw=True, include_m=True, include_l=False) | Draw a circular arc, controlled by center, radius, and start/end | degrees. | | Angles rotate from the x-axis towards the positive y-axis. | | c(self, cx1, cy1, cx2, cy2, ex, ey) | Draw a cubic Bezier curve (relative coordinates). | | h(self, dx) | Draw a horizontal line to this relative x coordinate. | | l(self, dx, dy) | Draw a line to this point (relative coordinates). | | m(self, dx, dy) | Start a new curve section from this point (relative coordinates). | | q(self, cx, cy, ex, ey) | Draw a quadratic Bezier curve (relative coordinates). | | s(self, cx2, cy2, ex, ey) | Draw a cubic Bezier curve, transitioning smoothly from the previous | (relative coordinates). | | t(self, ex, ey) | Draw a quadratic Bezier curve, transitioning soothly from the | previous (relative coordinates). | | v(self, dy) | Draw a horizontal line to this relative y coordinate. | | ---------------------------------------------------------------------- | Data and other attributes inherited from Path: | | TAG_NAME = 'path' | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | get_svg_defs(self) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | has_content = False | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.LinearGradient
Python Library Documentation: class LinearGradient in module drawsvg.defs class LinearGradient(DrawingDef) | LinearGradient(x1, y1, x2, y2, gradientUnits='userSpaceOnUse', **kwargs) | | A linear gradient to use as a fill or other color. | | Has <stop> nodes as children, added with `.add_stop()`. | | Method resolution order: | LinearGradient | DrawingDef | drawsvg.types.DrawingParentElement | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, x1, y1, x2, y2, gradientUnits='userSpaceOnUse', **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | add_stop(self, offset, color, opacity=None, **kwargs) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | TAG_NAME = 'linearGradient' | | ---------------------------------------------------------------------- | Methods inherited from DrawingDef: | | get_svg_defs(self) | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingParentElement: | | append(self, element, *, z=None) | | draw(self, obj, *, z=None, **kwargs) | | extend(self, iterable, *, z=None) | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingParentElement: | | has_content = True | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.Lines
Python Library Documentation: class Lines in module drawsvg.elements class Lines(Path) | Lines(sx, sy, *points, close=False, **kwargs) | | A sequence of connected lines (or a polygon). | | Additional keyword arguments are output as additional arguments to the SVG | node e.g. fill="red", stroke="#ff4477", stroke_width=2. | | Method resolution order: | Lines | Path | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, sx, sy, *points, close=False, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from Path: | | A(self, rx, ry, rot, large_arc, sweep, ex, ey) | Draw a circular or elliptical arc. | | See | https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#elliptical_arc_curve | | C(self, cx1, cy1, cx2, cy2, ex, ey) | Draw a cubic Bezier curve. | | H(self, x) | Draw a horizontal line to this x coordinate. | | L(self, x, y) | Draw a line to this point. | | M(self, x, y) | Start a new curve section from this point. | | Q(self, cx, cy, ex, ey) | Draw a quadratic Bezier curve. | | S(self, cx2, cy2, ex, ey) | Draw a cubic Bezier curve, transitioning smoothly from the previous. | | T(self, ex, ey) | Draw a quadratic Bezier curve, transitioning soothly from the | previous. | | V(self, y) | Draw a horizontal line to this y coordinate. | | Z(self) | Draw a line back to the previous m or M point. | | a(self, rx, ry, rot, large_arc, sweep, ex, ey) | Draw a circular or elliptical arc (relative coordinates). | | See | https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#elliptical_arc_curve | | append(self, command_str, *args) | | arc(self, cx, cy, r, start_deg, end_deg, cw=True, include_m=True, include_l=False) | Draw a circular arc, controlled by center, radius, and start/end | degrees. | | Angles rotate from the x-axis towards the positive y-axis. | | c(self, cx1, cy1, cx2, cy2, ex, ey) | Draw a cubic Bezier curve (relative coordinates). | | h(self, dx) | Draw a horizontal line to this relative x coordinate. | | l(self, dx, dy) | Draw a line to this point (relative coordinates). | | m(self, dx, dy) | Start a new curve section from this point (relative coordinates). | | q(self, cx, cy, ex, ey) | Draw a quadratic Bezier curve (relative coordinates). | | s(self, cx2, cy2, ex, ey) | Draw a cubic Bezier curve, transitioning smoothly from the previous | (relative coordinates). | | t(self, ex, ey) | Draw a quadratic Bezier curve, transitioning soothly from the | previous (relative coordinates). | | v(self, dy) | Draw a horizontal line to this relative y coordinate. | | ---------------------------------------------------------------------- | Data and other attributes inherited from Path: | | TAG_NAME = 'path' | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | get_svg_defs(self) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | has_content = False | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.LocalContext
Python Library Documentation: class LocalContext in module drawsvg.types
class LocalContext(builtins.object)
| LocalContext(context: drawsvg.types.Context, element: 'DrawingElement', parent: Union[ForwardRef('DrawingElement'), ForwardRef('Drawing')], siblings: Sequence[ForwardRef('DrawingElement')] = ()) -> None
|
| LocalContext(context: drawsvg.types.Context, element: 'DrawingElement', parent: Union[ForwardRef('DrawingElement'), ForwardRef('Drawing')], siblings: Sequence[ForwardRef('DrawingElement')] = ())
|
| Methods defined here:
|
| __delattr__(self, name)
| Implement delattr(self, name).
|
| __eq__(self, other)
| Return self==value.
|
| __hash__(self)
| Return hash(self).
|
| __init__(self, context: drawsvg.types.Context, element: 'DrawingElement', parent: Union[ForwardRef('DrawingElement'), ForwardRef('Drawing')], siblings: Sequence[ForwardRef('DrawingElement')] = ()) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| __setattr__(self, name, value)
| Implement setattr(self, name, value).
|
| write_tag_args(self, args, output_file, id_map=None)
| Called by an element during SVG output of its tag.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'context': <class 'drawsvg.types.Context'>, 'elemen...
|
| __dataclass_fields__ = {'context': Field(name='context',type=<class 'd...
|
| __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,or...
|
| __match_args__ = ('context', 'element', 'parent', 'siblings')
|
| siblings = ()
drawsvg.Marker
Python Library Documentation: class Marker in module drawsvg.defs class Marker(DrawingDef) | Marker(minx, miny, maxx, maxy, scale=1, orient='auto', **kwargs) | | A small drawing that can be placed at the ends of (or along) a path. | | This can be used for arrow heads or points on a graph for example. | By default, units are multiples of stroke width. | | Method resolution order: | Marker | DrawingDef | drawsvg.types.DrawingParentElement | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, minx, miny, maxx, maxy, scale=1, orient='auto', **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | TAG_NAME = 'marker' | | ---------------------------------------------------------------------- | Methods inherited from DrawingDef: | | get_svg_defs(self) | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingParentElement: | | append(self, element, *, z=None) | | draw(self, obj, *, z=None, **kwargs) | | extend(self, iterable, *, z=None) | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingParentElement: | | has_content = True | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.Mask
Python Library Documentation: class Mask in module drawsvg.defs class Mask(DrawingDef) | Mask(children=(), ordered_children=None, **args) | | A drawing where the gray value and transparency are used to control the | transparency of another shape. | | Has regular drawing elements as children. | | Method resolution order: | Mask | DrawingDef | drawsvg.types.DrawingParentElement | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Data and other attributes defined here: | | TAG_NAME = 'mask' | | ---------------------------------------------------------------------- | Methods inherited from DrawingDef: | | get_svg_defs(self) | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingParentElement: | | __init__(self, children=(), ordered_children=None, **args) | Initialize self. See help(type(self)) for accurate signature. | | append(self, element, *, z=None) | | draw(self, obj, *, z=None, **kwargs) | | extend(self, iterable, *, z=None) | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingParentElement: | | has_content = True | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.NoElement
Python Library Documentation: class NoElement in module drawsvg.elements class NoElement(drawsvg.types.DrawingElement) | A drawing element that has no effect | | Method resolution order: | NoElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __eq__(self, other) | Return self==value. | | __init__(self) | Initialize self. See help(type(self)) for accurate signature. | | write_svg_element(self, id_map, is_duplicate, output_file, dry_run, lcontext, force_dup=False) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __hash__ = None | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | get_svg_defs(self) | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.Path
Python Library Documentation: class Path in module drawsvg.elements class Path(drawsvg.types.DrawingBasicElement) | Path(d='', **kwargs) | | An arbitrary path. | | Path Supports building an SVG path by calling instance methods corresponding | to path commands. | | Complete descriptions of path commands: | https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#path_commands | | Additional keyword arguments are output as additional arguments to the SVG | node e.g. fill="red", stroke="#ff4477", stroke_width=2. | | Method resolution order: | Path | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | A(self, rx, ry, rot, large_arc, sweep, ex, ey) | Draw a circular or elliptical arc. | | See | https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#elliptical_arc_curve | | C(self, cx1, cy1, cx2, cy2, ex, ey) | Draw a cubic Bezier curve. | | H(self, x) | Draw a horizontal line to this x coordinate. | | L(self, x, y) | Draw a line to this point. | | M(self, x, y) | Start a new curve section from this point. | | Q(self, cx, cy, ex, ey) | Draw a quadratic Bezier curve. | | S(self, cx2, cy2, ex, ey) | Draw a cubic Bezier curve, transitioning smoothly from the previous. | | T(self, ex, ey) | Draw a quadratic Bezier curve, transitioning soothly from the | previous. | | V(self, y) | Draw a horizontal line to this y coordinate. | | Z(self) | Draw a line back to the previous m or M point. | | __init__(self, d='', **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | a(self, rx, ry, rot, large_arc, sweep, ex, ey) | Draw a circular or elliptical arc (relative coordinates). | | See | https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#elliptical_arc_curve | | append(self, command_str, *args) | | arc(self, cx, cy, r, start_deg, end_deg, cw=True, include_m=True, include_l=False) | Draw a circular arc, controlled by center, radius, and start/end | degrees. | | Angles rotate from the x-axis towards the positive y-axis. | | c(self, cx1, cy1, cx2, cy2, ex, ey) | Draw a cubic Bezier curve (relative coordinates). | | h(self, dx) | Draw a horizontal line to this relative x coordinate. | | l(self, dx, dy) | Draw a line to this point (relative coordinates). | | m(self, dx, dy) | Start a new curve section from this point (relative coordinates). | | q(self, cx, cy, ex, ey) | Draw a quadratic Bezier curve (relative coordinates). | | s(self, cx2, cy2, ex, ey) | Draw a cubic Bezier curve, transitioning smoothly from the previous | (relative coordinates). | | t(self, ex, ey) | Draw a quadratic Bezier curve, transitioning soothly from the | previous (relative coordinates). | | v(self, dy) | Draw a horizontal line to this relative y coordinate. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | TAG_NAME = 'path' | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | get_svg_defs(self) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | has_content = False | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.Pattern
Python Library Documentation: class Pattern in module drawsvg.defs class Pattern(DrawingDef) | Pattern(width, height, x=None, y=None, patternUnits='userSpaceOnUse', **kwargs) | | A repeating pattern of other drawing elements to use as a fill or other | color. | | Width and height specify the repetition period. Append regular drawing | elements to create the pattern. | | Method resolution order: | Pattern | DrawingDef | drawsvg.types.DrawingParentElement | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, width, height, x=None, y=None, patternUnits='userSpaceOnUse', **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | TAG_NAME = 'pattern' | | ---------------------------------------------------------------------- | Methods inherited from DrawingDef: | | get_svg_defs(self) | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingParentElement: | | append(self, element, *, z=None) | | draw(self, obj, *, z=None, **kwargs) | | extend(self, iterable, *, z=None) | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingParentElement: | | has_content = True | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.RadialGradient
Python Library Documentation: class RadialGradient in module drawsvg.defs class RadialGradient(DrawingDef) | RadialGradient(cx, cy, r, gradientUnits='userSpaceOnUse', fy=None, **kwargs) | | A radial gradient to use as a fill or other color. | | Has <stop> nodes as children, added with `.add_stop()`. | | Method resolution order: | RadialGradient | DrawingDef | drawsvg.types.DrawingParentElement | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, cx, cy, r, gradientUnits='userSpaceOnUse', fy=None, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | add_stop(self, offset, color, opacity=None, **kwargs) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | TAG_NAME = 'radialGradient' | | ---------------------------------------------------------------------- | Methods inherited from DrawingDef: | | get_svg_defs(self) | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingParentElement: | | append(self, element, *, z=None) | | draw(self, obj, *, z=None, **kwargs) | | extend(self, iterable, *, z=None) | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingParentElement: | | has_content = True | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.Raster
Python Library Documentation: class Raster in module drawsvg.raster class Raster(builtins.object) | Raster(png_data=None, png_file=None) | | Methods defined here: | | __init__(self, png_data=None, png_file=None) | Initialize self. See help(type(self)) for accurate signature. | | as_data_uri(self) | | save_png(self, fname) | | ---------------------------------------------------------------------- | Static methods defined here: | | from_arr(arr, out_file=None) | | from_svg(svg_data) | | from_svg_to_file(svg_data, out_file) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.Raw
Python Library Documentation: class Raw in module drawsvg.elements class Raw(drawsvg.types.DrawingElement) | Raw(content, defs=()) | | Raw unescaped text to include in the SVG output. | | Special XML characters like '<' and '&' in the content may have unexpected | effects or completely break the resulting SVG. | | Method resolution order: | Raw | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, content, defs=()) | Initialize self. See help(type(self)) for accurate signature. | | check_children_allowed(self) | | get_svg_defs(self) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | has_content = True | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | __eq__(self, other) | Return self==value. | | get_linked_elems(self) | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingElement: | | __hash__ = None
drawsvg.Rectangle
Python Library Documentation: class Rectangle in module drawsvg.elements class Rectangle(drawsvg.types.DrawingBasicElement) | Rectangle(x, y, width, height, **kwargs) | | A rectangle. | | Additional keyword arguments are output as additional arguments to the SVG | node e.g. fill="red", stroke="#ff4477", stroke_width=2. | | Method resolution order: | Rectangle | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, x, y, width, height, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | TAG_NAME = 'rect' | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | get_svg_defs(self) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | has_content = False | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.Set
Python Library Documentation: class Set in module drawsvg.elements class Set(Animate) | Set(attributeName, dur, to=None, begin=None, other_elem=None, **kwargs) | | Animation for a specific property of another element that sets the new | value without a transition. | | This should be added as a child of the element to animate. Otherwise the | referenced other element and this element must both be added to the drawing. | | Method resolution order: | Set | Animate | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, attributeName, dur, to=None, begin=None, other_elem=None, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | TAG_NAME = 'set' | | ---------------------------------------------------------------------- | Methods inherited from Animate: | | get_linked_elems(self) | | get_svg_defs(self) | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | has_content = False | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.SyncedAnimationConfig
Python Library Documentation: class SyncedAnimationConfig in module drawsvg.native_animation.synced_animation
class SyncedAnimationConfig(builtins.object)
| SyncedAnimationConfig(duration: float, start_delay: float = 0, end_delay: float = 0, repeat_count: Union[int, str] = 'indefinite', fill: str = 'freeze', freeze_frame_at: Optional[float] = None, show_playback_progress: bool = False, show_playback_controls: bool = False, pause_on_load: bool = False, controls_width: Optional[float] = None, controls_height: float = 20, controls_x: Optional[float] = None, controls_center_y: Optional[float] = None, bar_thickness: float = 4, bar_hpad: float = 32, bar_color: str = '#ccc', bar_past_color: str = '#05f', knob_rad: float = 6, knob_fill: str = '#05f', pause_width: float = 16, pause_corner_rad: float = 4, pause_color: str = '#05f', pause_icon_color: str = '#eee', controls_js: str = 'DEFAULT', controls_js_onload: str = 'svgOnLoad(event)', controls_draw_function: Callable[[ForwardRef('SyncedAnimationConfig'), bool], ForwardRef('Group')] = <function draw_scrub at 0x00000159122FDBC0>) -> None
|
| SyncedAnimationConfig(duration: float, start_delay: float = 0, end_delay: float = 0, repeat_count: Union[int, str] = 'indefinite', fill: str = 'freeze', freeze_frame_at: Optional[float] = None, show_playback_progress: bool = False, show_playback_controls: bool = False, pause_on_load: bool = False, controls_width: Optional[float] = None, controls_height: float = 20, controls_x: Optional[float] = None, controls_center_y: Optional[float] = None, bar_thickness: float = 4, bar_hpad: float = 32, bar_color: str = '#ccc', bar_past_color: str = '#05f', knob_rad: float = 6, knob_fill: str = '#05f', pause_width: float = 16, pause_corner_rad: float = 4, pause_color: str = '#05f', pause_icon_color: str = '#eee', controls_js: str = 'DEFAULT', controls_js_onload: str = 'svgOnLoad(event)', controls_draw_function: Callable[[ForwardRef('SyncedAnimationConfig'), bool], ForwardRef('Group')] = <function draw_scrub at 0x00000159122FDBC0>)
|
| Methods defined here:
|
| __eq__(self, other)
| Return self==value.
|
| __init__(self, duration: float, start_delay: float = 0, end_delay: float = 0, repeat_count: Union[int, str] = 'indefinite', fill: str = 'freeze', freeze_frame_at: Optional[float] = None, show_playback_progress: bool = False, show_playback_controls: bool = False, pause_on_load: bool = False, controls_width: Optional[float] = None, controls_height: float = 20, controls_x: Optional[float] = None, controls_center_y: Optional[float] = None, bar_thickness: float = 4, bar_hpad: float = 32, bar_color: str = '#ccc', bar_past_color: str = '#05f', knob_rad: float = 6, knob_fill: str = '#05f', pause_width: float = 16, pause_corner_rad: float = 4, pause_color: str = '#05f', pause_icon_color: str = '#eee', controls_js: str = 'DEFAULT', controls_js_onload: str = 'svgOnLoad(event)', controls_draw_function: Callable[[ForwardRef('SyncedAnimationConfig'), bool], ForwardRef('Group')] = <function draw_scrub at 0x00000159122FDBC0>) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| controls_draw_function = draw_scrub(config: 'SyncedAnimationConfig', hidden=False) -> 'Group' from drawsvg.native_animation.playback_control_ui
|
| extra_css(self, d, context)
|
| extra_drawing_elements(self, d, context)
|
| extra_javascript(self, d, context)
|
| extra_onload_js(self, d, context)
|
| override_args(self, args, lcontext)
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| total_duration
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'bar_color': <class 'str'>, 'bar_hpad': <class 'flo...
|
| __dataclass_fields__ = {'bar_color': Field(name='bar_color',type=<clas...
|
| __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,or...
|
| __hash__ = None
|
| __match_args__ = ('duration', 'start_delay', 'end_delay', 'repeat_coun...
|
| bar_color = '#ccc'
|
| bar_hpad = 32
|
| bar_past_color = '#05f'
|
| bar_thickness = 4
|
| controls_center_y = None
|
| controls_height = 20
|
| controls_js = 'DEFAULT'
|
| controls_js_onload = 'svgOnLoad(event)'
|
| controls_width = None
|
| controls_x = None
|
| end_delay = 0
|
| fill = 'freeze'
|
| freeze_frame_at = None
|
| knob_fill = '#05f'
|
| knob_rad = 6
|
| pause_color = '#05f'
|
| pause_corner_rad = 4
|
| pause_icon_color = '#eee'
|
| pause_on_load = False
|
| pause_width = 16
|
| repeat_count = 'indefinite'
|
| show_playback_controls = False
|
| show_playback_progress = False
|
| start_delay = 0
drawsvg.TSpan
Python Library Documentation: class TSpan in module drawsvg.elements class TSpan(_TextContainingElement) | TSpan(text, **kwargs) | | A line of text within the Text element. | | Method resolution order: | TSpan | _TextContainingElement | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Data and other attributes defined here: | | TAG_NAME = 'tspan' | | ---------------------------------------------------------------------- | Methods inherited from _TextContainingElement: | | __init__(self, text, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | ---------------------------------------------------------------------- | Data and other attributes inherited from _TextContainingElement: | | has_content = True | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | get_svg_defs(self) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.Text
Python Library Documentation: class Text in module drawsvg.elements class Text(drawsvg.types.DrawingParentElement) | Text(text='', *args, path=None, id=None, _skip_check=False, **kwargs) | | A line or multiple lines of text, optionally placed along a path. | | Additional keyword arguments are output as additional arguments to the SVG | node e.g. fill='red', font_size=20, letter_spacing=1.5. | | Useful SVG attributes: | - text_anchor: start, middle, end | - dominant_baseline: | auto, central, middle, hanging, text-top, mathematical, ... | See https://developer.mozilla.org/en-US/docs/Web/SVG/Element/text | | CairoSVG bug with letter spacing text on a path: The first two letters are | always spaced as if letter_spacing=1. | | Method resolution order: | Text | drawsvg.types.DrawingParentElement | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, text, font_size, x=None, y=None, *, center=False, line_height=1, line_offset=0, path=None, start_offset=None, path_args=None, tspan_args=None, cairo_fix=True, _skip_check=False, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | append_line(self, line, **kwargs) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(cls, text='', *args, path=None, id=None, _skip_check=False, **kwargs) | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | TAG_NAME = 'text' | | has_content = True | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingParentElement: | | append(self, element, *, z=None) | | draw(self, obj, *, z=None, **kwargs) | | extend(self, iterable, *, z=None) | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | get_svg_defs(self) | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.Title
Python Library Documentation: class Title in module drawsvg.elements
class Title(_TextContainingElement)
| Title(text, **kwargs)
|
| A title element.
|
| This element can be appended with shape.append_title("Your title!"), which
| can be useful for adding a tooltip or on-hover text display to an element.
|
| Method resolution order:
| Title
| _TextContainingElement
| drawsvg.types.DrawingBasicElement
| drawsvg.types.DrawingElement
| builtins.object
|
| Data and other attributes defined here:
|
| TAG_NAME = 'title'
|
| ----------------------------------------------------------------------
| Methods inherited from _TextContainingElement:
|
| __init__(self, text, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run)
| Override in a subclass to add data between the start and end tags.
|
| This will not be called if has_content is False.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from _TextContainingElement:
|
| has_content = True
|
| ----------------------------------------------------------------------
| Methods inherited from drawsvg.types.DrawingBasicElement:
|
| __eq__(self, other)
| Return self==value.
|
| add_attribute_key_sequence(self, attr, times, values, *, animation_args=None)
|
| add_key_frame(self, time, animation_args=None, **attr_values)
|
| all_children(self, lcontext=None)
| Return self.children and self.ordered_children as a single list.
|
| append_anim(self, animate_element)
|
| append_title(self, text, **kwargs)
|
| check_children_allowed(self)
|
| extend_anim(self, animate_iterable)
|
| extra_children_with_context(self, lcontext=None)
|
| get_svg_defs(self)
|
| write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run)
| Override in a subclass to add data between the start and end tags.
|
| This will not be called if has_content is False.
|
| write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run)
|
| write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False)
|
| ----------------------------------------------------------------------
| Readonly properties inherited from drawsvg.types.DrawingBasicElement:
|
| id
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from drawsvg.types.DrawingBasicElement:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from drawsvg.types.DrawingElement:
|
| get_linked_elems(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from drawsvg.types.DrawingElement:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
drawsvg.Use
Python Library Documentation: class Use in module drawsvg.elements class Use(drawsvg.types.DrawingBasicElement) | Use(other_elem, x, y, **kwargs) | | A copy of another element, drawn at a given position | | The referenced element becomes an SVG def shared between all Use elements | that reference it. Useful for drawings with many copies of similar shapes. | Additional arguments like `fill='red'` will be used as the default for this | copy of the shapes. | | Method resolution order: | Use | drawsvg.types.DrawingBasicElement | drawsvg.types.DrawingElement | builtins.object | | Methods defined here: | | __init__(self, other_elem, x, y, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | TAG_NAME = 'use' | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingBasicElement: | | __eq__(self, other) | Return self==value. | | add_attribute_key_sequence(self, attr, times, values, *, animation_args=None) | | add_key_frame(self, time, animation_args=None, **attr_values) | | all_children(self, lcontext=None) | Return self.children and self.ordered_children as a single list. | | append_anim(self, animate_element) | | append_title(self, text, **kwargs) | | check_children_allowed(self) | | extend_anim(self, animate_iterable) | | extra_children_with_context(self, lcontext=None) | | get_svg_defs(self) | | write_children_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_content(self, id_map, is_duplicate, output_file, lcontext, dry_run) | Override in a subclass to add data between the start and end tags. | | This will not be called if has_content is False. | | write_svg_defs(self, id_map, is_duplicate, output_file, lcontext, dry_run) | | write_svg_element(self, id_map, is_duplicate, output_file, lcontext, dry_run, force_dup=False) | | ---------------------------------------------------------------------- | Readonly properties inherited from drawsvg.types.DrawingBasicElement: | | id | | ---------------------------------------------------------------------- | Data and other attributes inherited from drawsvg.types.DrawingBasicElement: | | __hash__ = None | | has_content = False | | ---------------------------------------------------------------------- | Methods inherited from drawsvg.types.DrawingElement: | | get_linked_elems(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from drawsvg.types.DrawingElement: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
drawsvg.animate_element_sequence
Python Library Documentation: function animate_element_sequence in module drawsvg.native_animation.synced_animation
animate_element_sequence(times, element_sequence)
Animate a list of elements to appear one-at-a-time in sequence.
Elements should already be added to the drawing before using this.
drawsvg.animate_text_sequence
Python Library Documentation: function animate_text_sequence in module drawsvg.native_animation.synced_animation
animate_text_sequence(container, times: List[float], values: List[str], *text_args, kwargs_list=None, **text_kwargs)
Animate a sequence of text to appear one-at-a-time in sequence.
Multiple `Text` elements will be appended to the given `container`.
drawsvg.bytes_as_data_uri
Python Library Documentation: function bytes_as_data_uri in module drawsvg.url_encode
bytes_as_data_uri(data, strip_chars='\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0b\x0c\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f', mime='image/svg+xml')
Return a data URI with base64 encoding.
drawsvg.escape_cdata
Python Library Documentation: function escape_cdata in module drawsvg.elements escape_cdata(content)
drawsvg.frame_animate_jupyter
Python Library Documentation: function frame_animate_jupyter in module drawsvg.frame_animation
frame_animate_jupyter(draw_func=None, pause=False, clear=True, delay=0.1, **kwargs)
Returns a context manager that displays frames in a Jupyter notebook.
Example:
```
with frame_animate_jupyter(delay=0.5) as anim:
while True:
...
anim.draw_frame(...)
```
drawsvg.frame_animate_spritesheet
Python Library Documentation: function frame_animate_spritesheet in module drawsvg.frame_animation
frame_animate_spritesheet(out_file, draw_func=None, jupyter=False, **video_args)
Returns a context manager that stores frames and saves a spritesheet when
the context exits.
Example:
```
with frame_animate_spritesheet('sheet.png', row_length=10) as anim:
while True:
...
anim.draw_frame(...)
```
drawsvg.frame_animate_video
Python Library Documentation: function frame_animate_video in module drawsvg.frame_animation
frame_animate_video(out_file, draw_func=None, jupyter=False, **video_args)
Returns a context manager that stores frames and saves a video when the
context exits.
Example:
```
with frame_animate_video('video.mp4') as anim:
while True:
...
anim.draw_frame(...)
```
drawsvg.render_svg_frames
Python Library Documentation: function render_svg_frames in module drawsvg.video render_svg_frames(frames, align_bottom=False, align_right=False, bg=(255, 255, 255, 255), verbose=False, **kwargs)
drawsvg.save_video
Python Library Documentation: function save_video in module drawsvg.video
save_video(frames, file, verbose=False, **kwargs)
Save a series of drawings as a GIF or video.
Arguments:
frames: A list of `Drawing`s or a list of `numpy.array`s.
file: File name or file like object to write the video to. The
extension determines the output format.
align_bottom: If frames are different sizes, align the bottoms of each
frame in the video.
align_right: If frames are different sizes, align the right edge of each
frame in the video.
bg: If frames are different sizes, fill the background with this color.
(default is white: (255, 255, 255, 255))
duration: If writing a GIF, sets the duration of each frame.
fps: If writing a video, sets the frame rate in FPS.
**kwargs: Other arguments to imageio.mimsave().
drawsvg.svg_as_data_uri
Python Library Documentation: function svg_as_data_uri in module drawsvg.url_encode
svg_as_data_uri(txt, strip_chars='\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0b\x0c\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f', mime='image/svg+xml')
Return a data URI with base64 encoding, stripping unsafe chars for SVG.
drawsvg.svg_as_utf8_data_uri
Python Library Documentation: function svg_as_utf8_data_uri in module drawsvg.url_encode
svg_as_utf8_data_uri(txt, unsafe_chars='"', strip_chars='\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0b\x0c\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f', mime='image/svg+xml')
Returns a data URI without base64 encoding.
The characters '#&%' are always escaped. '#' and '&' break parsing of
the data URI. If '%' is not escaped, plain text like '%50' will be
incorrectly decoded to 'P'. The characters in `strip_chars` cause the
SVG not to render even if they are escaped.