SimpleTable defines a basic (rather memory intensive) table widget, used for display of unchanging data.
1 from GuiAppD import GuiAppD
2 class SimpleTableTest(GuiAppD):
3 appname='SimpleTable Test Application'
4 def createInterface(self):
5 table = self.createcomponent(
6 'testtable',
7 (), None,
8 SimpleTable,
9 (self.interior(),),
10 )
11 table.pack(
12 side=TOP,
13 expand=YES,
14 fill=BOTH,
15 )
16 text = open('/etc/passwd', 'rt').read()
17 table.setfromtext(text, ':', '\n')
18 #add some arbitrary text
19 for i in range(0, 15):
20 table.component('tabletext').insert(
21 'end',
22 'Before%d\tMiddle%d\tNext%d\tEnd%d\n' \
23 % (i, i, i, i))
24 table.component('tabletext').insert('end', 'A lot of text before the first tab.\tThen a lot of text in the middle.\tNow a lot of text at the end.')
25 return
26 SimpleTableTest().run()
27
Screenshot: