Box

class visigoth.containers.box.Box(element, margin=2, stroke_width=2, stroke='grey', padding=2, fill=None)

Wrap an element with a surrounding box

Parameters:

element (DiagramElement) – element to wrap

Keyword Arguments:
 
  • margin (int) – width of the margin in pixels
  • stroke_width (int) – width of the border in pixels
  • stroke (str) – colour of the border
  • padding (int) – width of the padding in pixels
  • fill (str) – fill colour for the box

Example

(Link to open example in new tab):

Source Code (Link to Github):

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

from visigoth import Diagram
from visigoth.containers import Box
from visigoth.common import Text

d = Diagram()
d.add(Text("Some Text"))
d.add(Box(Text("Some Text in an Orange Box"),fill="orange",stroke="darkred",stroke_width=4,margin=10,padding=5))

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