def test(): win = Window(title = "Exceptions", size = (200, 100)) but1 = Button("ApplicationError", action = raise_application_error) but2 = Button("Exception", action = raise_exception) win.place_column([but1, but2], left = 20, top = 20) win.shrink_wrap(padding = (20, 20)) win.show() application().run()
def test(): starter = Button("Start", action=start_task) stopper = Button("Stop", action=stop_task) win = Window(title="Tasks") win.place_column([starter, stopper], left=20, top=20, spacing=20) win.shrink_wrap(padding=(20, 20)) win.show() application().run()
def test(): win = Window(title="Exceptions", size=(200, 100)) but1 = Button("ApplicationError", action=raise_application_error) but2 = Button("Exception", action=raise_exception) win.place_column([but1, but2], left=20, top=20) win.shrink_wrap(padding=(20, 20)) win.show() application().run()
def test(): starter = Button("Start", action = start_task) stopper = Button("Stop", action = stop_task) win = Window(title = "Tasks") win.place_column([starter, stopper], left = 20, top = 20, spacing = 20) win.shrink_wrap(padding = (20, 20)) win.show() application().run()
def main(): global cb1, cb2, rg win = Window(title="Place Me By Your Side", width=720, height=500) view1 = TestDrawing(width=320, height=200) cb1 = CheckBox(title="Check Me!", action=checked_it) cb2 = CheckBox(title="Check Me Too!", action=checked_it) rbs = [] for i in range(1, 4): rb = RadioButton(title="Hoopy Option %d" % i, value=i) rbs.append(rb) rg = RadioGroup(rbs, action=option_chosen) pb = Button(title="Push Me!", action=pushed_it) view2 = TestScrollableDrawing(width=300, height=300) label = Label(text="Flavour:") entry = TextField(width=200) win.place(view1, left=10, top=10, border=1) win.place_row([cb1, cb2], left=10, top=(view1, 20), spacing=20) win.place_column(rbs, left=view1 + 20, top=10) win.place(pb, right=-20, bottom=-10, anchor='rb') win.place(view2, left=rbs[0] + 20, top=10, right=-20, bottom=pb - 10, scrolling='hv', anchor='ltrb', border=1) win.place(label, left=10, top=(cb1, 20)) win.place( entry, left=10, top=(label, 10), #border = 1 ) entry.become_target() win.show() import GUI GUI.run()
def test(): def select(): i = group.value name = cursor_names[i] say("Selecting cursor no. %d (%s)" % (i, name)) cursor = getattr(StdCursors, name) say("...", cursor) view.cursor = cursor win = Window(title = "Std Cursors") view = TestArea(size = (100, 100)) win.place(view, left = 20, top = 20) group = RadioGroup(action = select) for i, name in enumerate(cursor_names): group.add_item(RadioButton(title = name, value = i)) win.place_column(group, left = view + 20, top = 20, spacing = 0) win.shrink_wrap((20, 20)) win.show() application().run()
def test(orient, pos, pad): win = Window(title = "%s Sliders" % orient.upper(), position = pos, auto_position = False) sliders = [] if 1: #say("Creating slider 1") sl1 = sl2 = sl3 = None sl1 = Slider(orient = orient, max_value = 100) sl1.action = slid(sl1, orient, 1) sliders.append(sl1) if 1: #say("Creating slider 2") sl2 = Slider(orient = orient, max_value = 100, ticks = 6, live = False) sl2.value = 50 sl2.action = slid(sl2, orient, 2) sliders.append(sl2) if 1: #say("Creating slider 3") sl3 = Slider(orient = orient, max_value = 100, ticks = 6, discrete = True) sl3.value = 100 sl3.action = slid(sl3, orient, 3) sliders.append(sl3) #say("Created sliders") if orient == 'h': win.place_column(sliders, left = 20, top = 20, spacing = 20, sticky = 'ew') if sl2: sl2.vstretch = True if sl3: sl3.vmove = True else: win.place_row(sliders, left = 20, top = 20, spacing = 20, sticky = 'ns') if sl2: sl2.hstretch = True if sl3: sl3.hmove = True #say("Placed sliders") win.shrink_wrap() win.show()
rb.append(RadioButton(kind.capitalize(), value=kind, group=rg)) rg.set_value('stop') pb = [ Button(title="Alert", action=do_alert), Button(title="Alert2", action=do_alert2), Button(title="Alert3", action=do_alert3), ] pb2 = [ Button("Note Alert", action=do_note_alert), Button("Stop Alert", action=do_stop_alert), Button("Ask", action=do_ask), Button("Confirm", action=do_confirm), Button("Ask or Cancel", action=do_ask_or_cancel), Button("Confirm or Cancel", action=do_confirm_or_cancel), ] win.place_column(pb, left=20, top=20) win.place_column(rb, left=pb[2] + 20, top=20) win.place_column(pb2, left=rb[1].right + 20, top=20) win.size = (pb2[-1].right + 20, pb2[-1].bottom + 20) win.show() instructions = """ This lets you play around with the various standard dialog functions. Consult the documentation for details of how they should behave. Check that appropriate icons are displayed for the different flavours according to platform conventions. """ say(instructions) application().run()
rb.append(RadioButton(kind.capitalize(), value=kind, group=rg)) rg.set_value("stop") pb = [ Button(title="Alert", action=do_alert), Button(title="Alert2", action=do_alert2), Button(title="Alert3", action=do_alert3), ] pb2 = [ Button("Note Alert", action=do_note_alert), Button("Stop Alert", action=do_stop_alert), Button("Ask", action=do_ask), Button("Confirm", action=do_confirm), Button("Ask or Cancel", action=do_ask_or_cancel), Button("Confirm or Cancel", action=do_confirm_or_cancel), ] win.place_column(pb, left=20, top=20) win.place_column(rb, left=pb[2] + 20, top=20) win.place_column(pb2, left=rb[1].right + 20, top=20) win.size = (pb2[-1].right + 20, pb2[-1].bottom + 20) win.show() instructions = """ This lets you play around with the various standard dialog functions. Consult the documentation for details of how they should behave. Check that appropriate icons are displayed for the different flavours according to platform conventions. """ say(instructions) application().run()