Created
February 19, 2019 21:53
-
-
Save roberto-arista/b00f1cacb10389d10a6d263d88ffe544 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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