Difference between revisions of "Features/TableView Widget/Testing"
< Features | TableView Widget
Jump to navigation
Jump to search
(Created page with '== Simple example for SmootTable widget == import gtk import random from sugar.graphics.smoothtable import SmoothTable window = gtk.Window() scrolled = gtk.ScrolledWind…') |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | == Simple example for SmootTable widget == | + | === Simple example for SmootTable widget === |
import gtk | import gtk | ||
− | |||
from sugar.graphics.smoothtable import SmoothTable | from sugar.graphics.smoothtable import SmoothTable | ||
− | + | ||
window = gtk.Window() | window = gtk.Window() | ||
− | + | ||
scrolled = gtk.ScrolledWindow() | scrolled = gtk.ScrolledWindow() | ||
scrolled.set_policy(gtk.POLICY_ALWAYS, gtk.POLICY_ALWAYS) | scrolled.set_policy(gtk.POLICY_ALWAYS, gtk.POLICY_ALWAYS) | ||
window.add(scrolled) | window.add(scrolled) | ||
− | + | ||
− | def do_fill_in( | + | class Cell(gtk.Button): |
− | + | def do_fill_in(self, table, row, column): | |
− | table = SmoothTable(3, 3 | + | self.props.label = '%s:%s' % (row, column) |
− | table. | + | |
+ | 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() |
Latest revision as of 03:30, 28 November 2009
Simple example for SmootTable widget
import gtk from sugar.graphics.smoothtable import SmoothTable window = gtk.Window() scrolled = gtk.ScrolledWindow() scrolled.set_policy(gtk.POLICY_ALWAYS, gtk.POLICY_ALWAYS) window.add(scrolled) class Cell(gtk.Button): def do_fill_in(self, table, row, column): self.props.label = '%s:%s' % (row, column) table = SmoothTable(Cell, 3, 3) table.row_count = 100 scrolled.add(table) window.show_all() gtk.main()