1 """an example of add, remove for several container types"""
3 #this example contains a bit of a HACK
4 #when something is added/removed, chsize() may need to be called
5 #to ensure proper refresh of the screen, etc
6 #this may be fixed in the future, but for now, chsize must be called
10 from pygame.locals import *
12 # the following line is not needed if pgu is installed
13 import sys; sys.path.insert(0, "..")
20 c = gui.Container(width=240,height=120)
27 item = gui.Button(gui.Label('Disable'))
28 item.connect(gui.CLICK,i_disable,None)
33 w.value = gui.Label('Remove')
34 # Note - we need to disconnect the old signal handler first
35 w.disconnect(gui.CLICK)
36 w.connect(gui.CLICK,c_remove,w)
41 w.value = gui.Label('Add')
42 # Note - we need to disconnect the old signal handler first
43 w.disconnect(gui.CLICK)
44 w.connect(gui.CLICK,c_add,w)
48 w.connect(gui.CLICK,c_add,w)
52 t = gui.Table(width=240,height=120)
59 w = gui.Label(str(tn))
71 w.connect(gui.CLICK,t_add,None)
74 w = gui.Button('Remove')
75 w.connect(gui.CLICK,t_remove,None)
78 d = gui.Document(width=240,height=120)
84 w = gui.Label("%d "%dn)
95 w.connect(gui.CLICK,d_add,None)
99 w = gui.Button('Remove')
100 w.connect(gui.CLICK,d_remove,None)
107 tt.td(gui.Label("Container"))
109 tt.td(c,style={'border':1})
112 tt.td(gui.Label("Table"))
114 tt.td(t,style={'border':1})
117 tt.td(gui.Label("Document"))
119 tt.td(d,style={'border':1})
121 app.connect(gui.QUIT,app.quit,None)