ged2doc.dumbsvg¶
Python module for generating SVG.
Only the most trivial features are implemented, stuff that is required by ged2doc package.
Classes
|
Class for SVG document, top-level structure. |
|
Base class for all SVG elements. |
|
Class for SVG “a” element. |
|
Class for SVG line element. |
|
Class for SVG rect element. |
|
Class for SVG text element. |
|
Class for SVG tspan element. |
-
class
ged2doc.dumbsvg.
Doc
(width, height)[source]¶ Bases:
object
Class for SVG document, top-level structure.
- Parameters
- width, height
int
orstr
Document width and height, int for pixels or string.
- width, height
Methods
add
(element)Add new element to the document.
xml
([full_xml])Produce XML representation of the document.
-
class
ged2doc.dumbsvg.
Element
(tag, attributes=None, value='')[source]¶ Bases:
object
Base class for all SVG elements.
- Parameters
- tag
str
SVG tag name
- attributes :`list` [ `tuple` ], optional
List of tuples (attribute, attr_value).
- value
str
, optional Element value (text).
- tag
Methods
add
(element)Add new sub-element to the element.
xml
()Produce XML fragment for this element.
-
class
ged2doc.dumbsvg.
Line
(x1, y1, x2, y2, style=None)[source]¶ Bases:
ged2doc.dumbsvg.Element
Class for SVG line element.
- Parameters
- x1, y1, x2, y2
str
Coordinates of line ends.
- style
str
, optional Line style.
- x1, y1, x2, y2
Methods
add
(element)Add new sub-element to the element.
xml
()Produce XML fragment for this element.
-
class
ged2doc.dumbsvg.
Rect
(x, y, width, height, style=None)[source]¶ Bases:
ged2doc.dumbsvg.Element
Class for SVG rect element.
- Parameters
- x, y
str
Coordinates of top left corner of the box.
- width, height
str
Width and height of the box.
- style
str
, optional Line style.
- x, y
Methods
add
(element)Add new sub-element to the element.
xml
()Produce XML fragment for this element.
-
class
ged2doc.dumbsvg.
Text
(value='', font_size=None, text_anchor=None, style=None, class_=None)[source]¶ Bases:
ged2doc.dumbsvg.Element
Class for SVG text element.
- Parameters
- value
str
, optional Text to display.
- font_size
str
, optional Font size for text.
- text_anchor
str
Text anchor property.
- style
str
, optional Text style.
- class_
str
, optional Text CSS class.
- value
Methods
add
(element)Add new sub-element to the element.
xml
()Produce XML fragment for this element.
-
class
ged2doc.dumbsvg.
Tspan
(x, y, value='')[source]¶ Bases:
ged2doc.dumbsvg.Element
Class for SVG tspan element.
- Parameters
- x, y
str
Coordinates of the box.
- value
str
, optional Text to display.
- x, y
Methods
add
(element)Add new sub-element to the element.
xml
()Produce XML fragment for this element.
-
class
ged2doc.dumbsvg.
Hyperlink
(href)[source]¶ Bases:
ged2doc.dumbsvg.Element
Class for SVG “a” element.
- Parameters
- href
str
Hyperlink value.
- href
Methods
add
(element)Add new sub-element to the element.
xml
()Produce XML fragment for this element.