1 """Tables, Widgets, and Groups!
2 An example of tables and most of the included widgets.
6 from pygame.locals import *
8 # the following line is not needed if pgu is installed
9 import sys; sys.path.insert(0, "..")
13 # Load an alternate theme to show how it is done. You can also
14 # specify a path (absolute or relative) to your own custom theme:
16 # app = gui.Desktop(theme=gui.Theme("path/to/theme"))
19 app.connect(gui.QUIT,app.quit,None)
21 ##The table code is entered much like HTML.
27 c.td(gui.Label("Gui Widgets"),colspan=4)
31 btn = gui.Button("Click Me!")
32 btn.connect(gui.CLICK, cb)
35 c.td(gui.Label("Button"))
40 c.td(gui.Label("Switch"))
41 c.td(gui.Switch(False),colspan=3)
44 c.td(gui.Label("Checkbox"))
45 ##Note how Groups are used for Radio buttons, Checkboxes, and Tools.
47 g = gui.Group(value=[1,3])
48 c.td(gui.Checkbox(g,value=1))
49 c.td(gui.Checkbox(g,value=2))
50 c.td(gui.Checkbox(g,value=3))
54 c.td(gui.Label("Radio"))
56 c.td(gui.Radio(g,value=1))
57 c.td(gui.Radio(g,value=2))
58 c.td(gui.Radio(g,value=3))
61 c.td(gui.Label("Select"))
64 e.add("Horse",'horse')
70 c.td(gui.Label("Tool"))
71 g = gui.Group(value='b')
72 c.td(gui.Tool(g,gui.Label('A'),value='a'))
73 c.td(gui.Tool(g,gui.Label('B'),value='b'))
74 c.td(gui.Tool(g,gui.Label('C'),value='c'))
77 c.td(gui.Label("Input"))
79 print("Input received")
80 w = gui.Input(value='Cuzco',size=8)
81 w.connect("activate", cb)
85 c.td(gui.Label("Slider"))
86 c.td(gui.HSlider(value=23,min=0,max=100,size=20,width=120),colspan=3)
89 c.td(gui.Label("Keysym"))
90 c.td(gui.Keysym(),colspan=3)
93 c.td(gui.Label("Text Area"), colspan=4, align=-1)
96 c.td(gui.TextArea(value="Cuzco the Goat", width=150, height=70), colspan=4)