Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from vanilla import Window, RadioGroup, SquareButton
class ExampleCtrl(object):
ledsAmount = 6
index = 0
def __init__(self):
self.w = Window((150, 150), '% modulo')
self.w.someLeds = RadioGroup((20, 20, -20, -20),
[""]*self.ledsAmount,
callback=self.radioGroupCallback)
self.w.up = SquareButton((-60, 20, 40, 40), "↑",
callback=self.upCallback)
self.w.dw = SquareButton((-60, -60, 40, 40), "↓",
callback=self.dwCallback)
self.w.open()
def radioGroupCallback(self, sender):
print(sender.get())
def upCallback(self, sender):
self.index -= 1
self.w.someLeds.set(self.index % self.ledsAmount)
def dwCallback(self, sender):
self.index += 1
self.w.someLeds.set(self.index % self.ledsAmount)
ec = ExampleCtrl()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment