ButtonGrid

class visigoth.common.buttongrid.ButtonGrid(stroke=None, stroke_width=0, padding=10, fill=None)

Create a “grid” holding multiple buttons, parameters define defaults for buttons

Keyword Arguments:

stroke_width(int): width of the grid lines in pixels stroke(str): colour of the grid lines padding(int): width of the cell padding in pixels fill(str): fill colour for the cells

Notes

When one of the buttons is pressed the buttongrid will generate an event with the value set to the click_value associated with the button on channel “click”

addButton(row, column, button, initially_selected=False)

Example

(Link to open example in new tab):

Source Code (Link to Github):

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

from visigoth import Diagram
from visigoth.common import Button, ButtonGrid

d = Diagram()

bg = ButtonGrid()
bg.addButton(0,1,Button("North Button"))
bg.addButton(1,0,Button("West Button"))
bg.addButton(1,1,Button("Centre Button"),initially_selected=True)
bg.addButton(1,2,Button("East Button"))
bg.addButton(2,1,Button("South Button"))

d.add(bg)
html = d.draw(format="html")

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