def show(self): a = m5stack.ButtonA(callback=self._up_handler) b = m5stack.ButtonB(callback=self._select_handler) c = m5stack.ButtonC(callback=self._down_handler) self.draw_all() while self.selected is None: sleep_ms(50) a.deinit() b.deinit() c.deinit() return self.selected
m5stack.tone(1300, duration=10, volume=1) def button_hander_b(pin, pressed): if pressed is True: tft.text( tft.CENTER, tft.LASTY, "> Button B pressed. " ) m5stack.tone(2000, duration=10, volume=1) else: tft.text( tft.CENTER, tft.LASTY, "> Button B released. " ) m5stack.tone(1500, duration=10, volume=1) def button_hander_c(pin, pressed): if pressed is True: tft.text( tft.CENTER, tft.LASTY, "> Button C pressed. " ) m5stack.tone(2200, duration=10, volume=1) else: tft.text( tft.CENTER, tft.LASTY, "> Button C released. " ) m5stack.tone(1800, duration=10, volume=1) a = m5stack.ButtonA(callback=button_hander_a) b = m5stack.ButtonB(callback=button_hander_b) c = m5stack.ButtonC(callback=button_hander_c)