Sequence

class visigoth.containers.sequence.Sequence(spacing=20, orientation='vertical')

Construct a container holding multiple elements in a sequence layout

Keyword Arguments:
 
  • spacing (int) – spacing between elements in pixels
  • orientation (str) – vertical|horizontal whether to layout the sequence top-to-bottom or left-to-right

The way you might use me is:

>>> d = Diagram()
>>> s = Sequence()
>>> s.add(Text("Here is some text"))
>>> s.add(Text("Here is some more text"))
>>> d.add(s)
add(element)

Add an element to the sequence to appear after previously added elements

Parameters:element (DiagramElement) – the element to append to the sequence

Example

(Link to open example in new tab):

Source Code (Link to Github):

# -*- coding: utf-8 -*-

from visigoth import Diagram
from visigoth.containers import Sequence, Box
from visigoth.common import Text, Space

d = Diagram()

s0 = Sequence()
s0.add(Space(0,300))
s0.add(Text("Left").setLeftJustified()).add(Text("Center")).add(Text("Right").setRightJustified())
d.add(s0)

s = Sequence(spacing=20,orientation="horizontal")
s.add(Box(Text("Red Box"),fill="red")).add(Box(Text("Green Box"),fill="green")).add(Box(Text("Blue Box"),fill="blue"))
d.add(Box(s,fill="lightgrey"))

html = d.draw(format="html")
f = open("example.html", "w")
f.write(html)
f.close()