def __init__(self, symbol, text, *args, **kwds): super().__init__(*args, **kwds) self.symbol = lvgl.Label(self) self.symbol.set_text(symbol) self.symbol.set_style(symbolstyle) self.symbol.align(self, lvgl.ALIGN.CENTER, 0, 0) self.label = lvgl.Label(self) self.label.set_text(text) self.label.align(self, lvgl.ALIGN.CENTER, 20, 0)
def __init__(self, *args, **kwds): super().__init__(*args, **kwds) self.btnPrint = SymbolButton(lvgl.SYMBOL_PLAY, 'Print', self) self.btnPrint.set_x(0) self.btnPrint.set_y(0) self.btnPrint.set_width(160) self.btnPrint.set_height(90) self.btnChange = SymbolButton(lvgl.SYMBOL_SHUFFLE, 'Change filament', self) self.btnChange.set_x(160) self.btnChange.set_y(0) self.btnChange.set_width(160) self.btnChange.set_height(90) self.btnPreheat = SymbolButton(lvgl.SYMBOL_CHARGE, 'Preheat', self) self.btnPreheat.set_x(0) self.btnPreheat.set_y(90) self.btnPreheat.set_width(160) self.btnPreheat.set_height(90) self.btnSettings = SymbolButton(lvgl.SYMBOL_SETTINGS, 'Settings', self) self.btnSettings.set_x(160) self.btnSettings.set_y(90) self.btnSettings.set_width(160) self.btnSettings.set_height(90) self.lblStatus = lvgl.Label(self) self.lblStatus.set_text('\uf026 heating') self.lblStatus.align(self, lvgl.ALIGN.IN_BOTTOM_LEFT, 5, -5)
def init_gui(self): self.button = lvgl.Btn(lvgl.scr_act()) self.button.set_size(150,50) self.button.align(self.button.get_parent(), lvgl.ALIGN_IN_TOP_MID, 0, 10) lvgl.Label(self.button).set_text('Push me') self.label = lvgl.Label(lvgl.scr_act()) self.label.set_text('message') self.label.set_size(150,50) self.label.align(self.button, lvgl.ALIGN_OUT_BOTTOM_LEFT, 0, 0) self.button.set_action(lvgl.BTN_ACTION_CLICK, lambda: self.label.set_text('click')) self.button.set_action(lvgl.BTN_ACTION_PR, lambda: self.label.set_text('press')) self.button.set_action(lvgl.BTN_ACTION_LONG_PR, lambda: self.label.set_text('long press')) self.button.set_action(lvgl.BTN_ACTION_LONG_PR_REPEAT, lambda: self.label.set_text('long press repeat'))
QtGui.QImage.Format_RGB16) pm = QtGui.QPixmap.fromImage(img) self.setPixmap(pm) win = LvglWindow() win.show() # Build a GUI # run this script using -i to try commands interactively b1 = lvgl.Btn(lvgl.scr_act()) b1.set_size(150, 50) b1.align(b1.get_parent(), lvgl.ALIGN.IN_TOP_MID, 0, 10) l1 = lvgl.Label(b1) l1.set_text('Push 1') s1 = lvgl.Slider(lvgl.scr_act()) s1.align(b1, lvgl.ALIGN.OUT_BOTTOM_MID, 0, 10) s1 = lvgl.scr_act() s2 = lvgl.Obj() lst = lvgl.List(s2) lst.set_width(320) lst.set_height(200) lst.set_sb_mode(lvgl.SB_MODE.AUTO) # No spacing between items st1 = lvgl.style_t(lst.get_style(lvgl.LIST_STYLE.SCRL))