def get_barcodes(parent, commands): global scan_in_barcode scan_in_barcode = TextBox(parent, width=22, grid=[1, 2, 2, 1], align='left') scan_in_barcode.text_color = display_config.text_color scan_in_barcode.font = display_config.text_font scan_in_barcode.text_size = display_config.text_size scan_in_barcode.when_key_pressed = commands[0] global scan_out_barcode scan_out_barcode = TextBox(parent, width=22, grid=[1, 2, 2, 1], align='left') scan_out_barcode.text_color = display_config.text_color scan_out_barcode.font = display_config.text_font scan_out_barcode.text_size = display_config.text_size scan_out_barcode.when_key_pressed = commands[1] global look_up_barcode look_up_barcode = TextBox(parent, width=22, grid=[1, 2, 2, 1], align='left') look_up_barcode.text_color = display_config.text_color look_up_barcode.font = display_config.text_font look_up_barcode.text_size = display_config.text_size look_up_barcode.when_key_pressed = commands[2]
def deger(): def highlight(): text_box.bg = "lightblue" def lowlight(): text_box.bg = "white" app = App() text_box = TextBox(app) # When the mouse enters the TextBox text_box.when_mouse_enters = highlight # When the mouse leaves the TextBox text_box.when_mouse_leaves = lowlight def do_this(): print(text_box.value) text_box.when_key_pressed = do_this app.display()
# print(item_list) InputBox.clear() i = len(item_list) # else: print(data.key) FoodApp = App(title="Randomizer", layout="auto", height=win_height, width=640, bg="#424242", visible=True) Box(FoodApp, width=10, height=25) Instruction = Text(FoodApp, "Type one of the options and press 'space'", size=20, color="white") Box(FoodApp, width=10, height=25) InputBox = TextBox(FoodApp) InputBox.when_key_pressed = update Box(FoodApp, width=100, height=5) answer = TextBox(FoodApp) answer.bg = "#424242" answer.textcolor = "white" answer.visible = False done = PushButton(FoodApp, command=randomizer, args=[answer], text="Randomize") FoodApp.display()
def right_released(): waffle.set_pixel(0, 0, "grey") app = App() text = Text(app, text="events") slider = Slider(app) text_box = TextBox(app) check = CheckBox(app, "check") waffle = Waffle(app) # when clicked text.when_clicked = intro # when key pressed text_box.when_key_pressed = key_pressed # highlight widget when move over check.when_mouse_enters = mouse_enters check.when_mouse_leaves = mouse_leaves slider.when_mouse_enters = mouse_enters slider.when_mouse_leaves = mouse_leaves text_box.when_mouse_enters = mouse_enters text_box.when_mouse_leaves = mouse_leaves waffle.when_mouse_enters = mouse_enters waffle.when_mouse_leaves = mouse_leaves # right button pressed and released waffle.when_right_button_pressed = right_pressed waffle.when_right_button_released = right_released
def read_key(event_data): print("Read : " + event_data.key) def forward(): print('F') def backwards(): print('B') def right(): print('R') def left(): print('L') app = App("Key Testing", layout="auto") key_w = TextBox(app) text = Text(app, text="S", visible=True) key_w.when_key_pressed = read_key app.display()