def test(): view = TestView(size = (300, 200)) win = Window(title = "Coloured Text") win.add(view) win.shrink_wrap() win.show() run()
def main(): f = None args = sys.argv[1:] if args: fontsize = int(args[0]) sf = StdFonts.system_font f = Font(sf.family, fontsize, sf.style) #showfont("Using font", f) win = Window(title = "Heights") if f: kwds = {'font': f} else: kwds = {} controls = [ Label(text = "Label", **kwds), TextField(text = "Text", **kwds), CheckBox(title = "Check", **kwds), RadioButton(title = "Radio", **kwds), Slider(orient = 'h', width = 50), #Button(title = "Button", **kwds), ] #for ctl in controls: # say("Height of %r is %s" % (ctl, ctl.height)) win.place_row(controls, left = 10, top = 10) win.shrink_wrap(padding = (10, 10)) win.show() run()
def test(): view = TestView(size=(300, 200)) win = Window(title="Coloured Text") win.add(view) win.shrink_wrap() win.show() run()
def main(): f = None args = sys.argv[1:] if args: fontsize = int(args[0]) sf = StdFonts.system_font f = Font(sf.family, fontsize, sf.style) #showfont("Using font", f) win = Window(title="Heights") if f: kwds = {'font': f} else: kwds = {} controls = [ Label(text="Label", **kwds), TextField(text="Text", **kwds), CheckBox(title="Check", **kwds), RadioButton(title="Radio", **kwds), Slider(orient='h', width=50), #Button(title = "Button", **kwds), ] #for ctl in controls: # say("Height of %r is %s" % (ctl, ctl.height)) win.place_row(controls, left=10, top=10) win.shrink_wrap(padding=(10, 10)) win.show() run()
50, 'right', format="%.2f", parser=float, editable=True)) win = Window(title="Table") win.add(view) view.anchor = 'ltrb' win.shrink_wrap() view.become_target() view.selected_row_num = 0 win.show() instructions = """ There should be a window containing a table with the following columns: "Code", left justified, not editable "Name", left justified, editable "Price", right justified, format "%.2f", editable Mouse-down events should be reported together with the row number and column id of the clicked cell. Clicking or tabbing beyond the last row should be reported as "Navigate outside". """ print instructions run()
# # Python GUI - Test keys # from GUI import Window, run from testing import say class TestWindow(Window): def key_down(self, event): say("char = %r key = %r unichars = %r _keycode = 0x%04x" % ( event.char, event.key, event.unichars, event._keycode)) instructions = """ Check that the correct 'char' and 'key' values are produced for all keys. """ say(instructions) win = TestWindow(title = "Test Keys") win.show() run()