from sguigee import window, textbox, button, row with window(title='Textbox'): with row(): t = textbox() @button("Go") def go_button_click(): print(t.get(), flush=True)
from sguigee import window, row, textbox, button, show_message with window(title="Add"): with row(): a = textbox() b = textbox() with row(): @button("Add") def add_button_click(): show_message(int(a.get()) + int(b.get()))
return _button def make_operator(t, op): @button(t, expand=False, use_monospace_font=True) def _button(): stack.append(float(output.get())) output.set("") stack.append(op) stack = [] with window(title="Calculator", set_minimum_size=True, can_resize=False): with row(): output = textbox() with row(): make_button("1") make_button("2") make_button("3") make_operator("+", op.add) with row(): make_button("4") make_button("5") make_button("6") make_operator("-", op.sub) with row(): make_button("7")