3
from enthought.enable.example_support import DemoFrame, demo_main
5
from enthought.enable.api import Container, Window, TextField
6
from enthought.enable.stacked_container import VStackedContainer, HStackedContainer
7
from enthought.enable.overlay_container import OverlayContainer
9
class MyFrame(DemoFrame):
10
def _create_window(self):
12
stack = VStackedContainer(position=[0,0], bounds=[500,500],
13
halign='center', valign='center', #border_visible=True,
14
fit_components='hv', auto_size=True, stack_order='top_to_bottom',
17
strings = ["apple", "banana", "cherry", "durian",
18
"eggfruit", "fig", "grape", "honeydew"]
20
for i, s in enumerate(strings):
21
label = TextField(text=s, resizable='', bounds=[100+i*10,20],
22
bgcolor='red', #border_visible=True,
24
number = TextField(text=str(i+1), resizable='',
25
bgcolor='blue', #border_visible=True,
26
text_offset=1, can_edit=False, bounds=[20,20])
27
row = HStackedContainer(fit_components='hv', auto_size=True,
29
valign='top', border_visible=True)
34
#print stack.components
35
container = Container(position=[20,20], bounds=[500,500])
37
container2 = Container(bounds=[600,600])
38
container2.add(container)
39
return Window(self, -1, component=container2)
41
if __name__ == "__main__":
42
demo_main(MyFrame, size=[600,600])