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()
from guizero import App, TextBox, PushButton, Text, info app = App() def btn_go_clicked(): info("Greetings", "Hello, " + txt_name.value + " - I hope you're having a nice day") def highlight(): txt_name.bg = "light blue" def lowlight(): txt_name.bg = None lbl_name = Text(app, text="Hello. What's your name?") txt_name = TextBox(app) # when the mouse enters the button txt_name.when_mouse_enters = highlight # when the mouse leaves the button txt_name.when_mouse_leaves = lowlight btn_go = PushButton(app, command=btn_go_clicked, text="Done") app.display()
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 app.display()
align="right") editor = TextBox(app, multiline=True, height="fill", width="fill") preferences_controls = Box(app, align="bottom", width="fill", border=True) font = Combo(preferences_controls, options=[ "courier", "times new roman", "verdana", "calibri", "algerian", "arial", "broadway", "impact", "ravie", "rockwell", "arial black", "monospace", "" ], align="left", command=change_font) size = Slider(preferences_controls, align="left", start=11, end=150, command=change_text_size) font_color = Combo( preferences_controls, options=['pink', 'red', 'orange', 'green', 'black', 'yellow'], align='left', command=change_color) editor.when_mouse_enters = highlight editor.when_mouse_leaves = lowlight editor.color = font_color app.display()
from guizero import App, TextBox 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 app.display()