def __init__(self): global decorations if not yutani.yutani_lib: yutani.Yutani() if not decorations: decorations = yutani.Decor() self.decorated = True self._win = None self.title = "TTK Window"
# Do unfocus stuff here else: changed = False if changed or redraw: self.draw() def keyboard_event(self, msg): if msg.event.action == yutani.KeyAction.ACTION_DOWN: if not self.input.is_focused: self.input.focus_enter() self.input.keyboard_event(msg) # Do keyboard stuff here if __name__ == '__main__': yutani.Yutani() d = yutani.Decor() title = "Input Box" if len(sys.argv) < 2 else sys.argv[1] icon = "default" if len(sys.argv) < 3 else sys.argv[2] def print_text(text_box): print(text_box.text()) sys.exit(0) window = TextInputWindow(d, title, icon, callback=print_text) window.draw() yutani_mainloop.mainloop()
def keyboard_event(self, msg): if msg.event.action != 0x01: return # Ignore anything that isn't a key down. if msg.event.key == b"q": self.close() sys.exit(0) if msg.event.key == b' ': self.page += 1 if self.page >= len(pages): self.close() sys.exit(0) self.load_page() self.draw() if __name__ == '__main__': yctx = yutani.Yutani() d = yutani.Decor() hints = HintWindow() hints.draw() window = WizardWindow(d) window.draw() subprocess.Popen(['check-updates.py']) while 1: # Poll for events. msg = yutani.yutani_ctx.poll() if msg.type == yutani.Message.MSG_WELCOME: hints.resize(msg.display_width,msg.display_height)