def __init__(self, **kwargs): super().__init__(**kwargs) self.special_number = ui.Number(special_value='Off', minimum=0, maximum=7) self.scroll_area = ui.ScrollArea( layout=ui.Row( ui.Column( ui.Label("Unbound", text_format='auto'), ui.Number(editing_finished=lambda: ui.show_info("Editing finished.")), ui.Label("Unbound, decimals=1"), ui.Number(42, decimals=1, focus_in=lambda: print("focus: in"), focus_out=lambda: print("focus: out")), ui.Label("Unbound, decimals=3, step=.01"), ui.Number(.042, decimals=3, step=.01), ui.Label("Unbound, decimals=3, adaptive=True"), ui.Number(.042, decimals=3, adaptive=True), ui.Label("0...3, value=1"), ui.Number(1, minimum=0, maximum=3), ui.Label("0...7, special_value='Off'"), ui.Row( self.special_number, ui.Button("&Reset", width=56, clicked=self.on_reset) ), ui.Label("readonly"), ui.Number(42, readonly=True), ui.Label("readonly, styled"), ui.Number(42, readonly=True, stylesheet="color: red; background: #eee"), ui.Spacer(), ), ui.Spacer(), stretch=(3, 7) ) ) self.layout = self.scroll_area
def on_changed(self, item): ui.show_info(f"Selected: {item} ({type(item).__name__})")
def on_finished(): print("DONE") ui.show_info("Worker finished.")
def on_help(): ui.show_info("Helpful information.")
def on_click(button): if button == 'restore_defaults': item_list.clear() item_list.extend(defaults) ui.show_info("Reset to defaults.")
def on_apply(self): ui.show_info( text="Application restart required for changes to take effect.") for tab in self.tab_widget: tab.store()