Skip to content
Newer
Older
100644 28 lines (20 sloc) 684 Bytes
391939f @baverman basic grid implementation
authored Jul 22, 2011
1 import gtk
2
3 from uxie.data.grid import Grid, RowRenderer, TextColumn
4
5 w = gtk.Window(gtk.WINDOW_TOPLEVEL)
6 w.set_default_size(500, 500)
7 w.connect('delete-event', gtk.main_quit)
8
9 sw = gtk.ScrolledWindow()
10 sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
11 w.add(sw)
12
13 model = [{'id':i, 'name':'name%d' % i, 'desc': 'description %d' % i } for i in xrange(100)]
14
15 renderer = RowRenderer()
e23c3b6 @baverman fix chaotic 0.5 additions
authored Jul 22, 2011
16 renderer.add_column(TextColumn('id'), pixels=30)
391939f @baverman basic grid implementation
authored Jul 22, 2011
17 renderer.add_column(TextColumn('name'), percents=30, chars=10)
18 renderer.add_column(TextColumn('desc'), percents=70, chars=20)
19
20 grid = Grid()
21 grid.renderer = renderer
22 grid.model = model
23 sw.add(grid)
298fc04 @baverman cursor
authored Jul 24, 2011
24 grid.set_cursor(0, 0)
391939f @baverman basic grid implementation
authored Jul 22, 2011
25
26 w.show_all()
27
28 gtk.main()
Something went wrong with that request. Please try again.