Difference between revisions of "Features/TableView Widget/Testing"

From Sugar Labs
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…')
 
Line 5: Line 5:
 
   
 
   
 
  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(cell, row, column):
 
  def do_fill_in(cell, row, column):
 
     cell.props.label = '%s:%s' % (row, column)
 
     cell.props.label = '%s:%s' % (row, column)

Revision as of 20:48, 27 November 2009

Simple example for SmootTable widget

import gtk
import random

from sugar.graphics.smoothtable import SmoothTable

window = gtk.Window()

scrolled = gtk.ScrolledWindow()
scrolled.set_policy(gtk.POLICY_ALWAYS, gtk.POLICY_ALWAYS)
window.add(scrolled)

def do_fill_in(cell, row, column):
    cell.props.label = '%s:%s' % (row, column)
table = SmoothTable(3, 3, gtk.Button, do_fill_in)
table.bin_rows = 100
scrolled.add(table)

window.show_all()
gtk.main()