Open main menu
Home
Random
Log in
Settings
About Sugar Labs
Disclaimers
Sugar Labs
Search
Changes
← Older edit
Features/TableView Widget/Testing
(view source)
Revision as of 04:30, 28 November 2009
10 bytes added
,
04:30, 28 November 2009
→Simple example for SmootTable widget
Line 1:
Line 1:
−
== Simple example for SmootTable widget ==
+
=
== Simple example for SmootTable widget
=
==
import gtk
import gtk
−
import random
from sugar.graphics.smoothtable import SmoothTable
from sugar.graphics.smoothtable import SmoothTable
Line 12:
Line 11:
window.add(scrolled)
window.add(scrolled)
−
def do_fill_in(
cell
, row, column):
+
class Cell(gtk.Button):
−
cell
.props.label = '%s:%s' % (row, column)
+
def do_fill_in(
self, table
, row, column):
−
table = SmoothTable(3, 3
, gtk.Button, do_fill_in
)
+
self
.props.label = '%s:%s' % (row, column)
−
table.
bin_rows
= 100
+
+
table = SmoothTable(
Cell,
3, 3)
+
table.
row_count
= 100
scrolled.add(table)
scrolled.add(table)
window.show_all()
window.show_all()
gtk.main()
gtk.main()
Alsroot
Bots
,
Bureaucrats
,
Check users
,
Administrators
,
Widget editors
5,705
edits