class visigoth.common.button.Button(text=None, image=None, padding=2, font_height=24, text_attributes={}, url=None, fill='white', push_fill='red', stroke='black', stroke_width=1, r=5, click_value='click')

Create a button

Keyword Arguments
  • text (str) – the text to display in the button

  • image (visigoth.common.Image) – an image element to display in the button

  • padding (int) – define padding around button content in pixels

  • font_height (int) – font size in pixeks

  • text_attributes (dict) – a dict containing SVG name/value attributes

  • url (str) – url to link to from the text

  • fill (str) – the background hue for the button

  • push_fill (str) – the background hue for the button when pushed

  • stroke (str) – the stroke hue for the line around the button

  • stroke_width (int) – the stroke width for the line around the button

  • r (int) – the button corner radius in pixels

  • click_value (str) – the event value emitted when the button is clicked


When pressed the button will generate an event with the value of the click_value parameter on channel “click”


(Link to open example in new tab):

Source Code (Link to Github):

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

import os
import sys

from visigoth import Diagram
from visigoth.common import Button
from visigoth.common import Image

d = Diagram()

folder = os.path.split(sys.argv[0])[0]
i = Image(mime_type="image/jpeg",
          tooltip="MtCleveland Volcano Eruption")
html = d.draw(format="html")

f = open("example.html", "w")