from sguigee import window, row, label with window(title="Test"): with row(): label("Hello World")
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()))
def _button(): output.set(output.get() + text) 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)
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 canvas, window, row, button, after, show_message import random with window(title="Memory Game"): with row(): c = canvas(width=200, height=200) c.create_text((100, 100), text="Press 'Go' to begin\n the Memory Game.") with row(): @button("Go") def go_button(): c.clear() word = random.choice(["hi", "hello"]) c.create_text((100, 100), text=word) @after(5) def on_timer(): c.clear() c.create_text((100, 100), text="Now, can you remember\n what the word was?\n Click 'Guess' to try.") go_button.destroy() @button("Guess") def guess_button(): c.destroy() guess_button.destroy() a = textbox() @button("Continue") def continue_button(): if a.get() == word: show_message("Well Done!")