-# 11/6/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for V2.5
-# o The mixin features were all commented out. Is it broke? Should it even
-# be in the source? Or is it left as an exercise to the reader?
-#
-# 11/25/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Robin confirms, this is tutorial code. But be warned! It has not been
-# converted OR tested!
-#
import wx
import wx.grid as gridlib
self.Bind(wx.EVT_IDLE, self.OnIdle)
- self.CreateGrid(25, 25) #, wxGrid.wxGridSelectRows)
+ self.CreateGrid(25, 25)#, gridlib.Grid.SelectRows)
##self.EnableEditing(False)
# simple cell formatting
self.SetColLabelAlignment(wx.ALIGN_LEFT, wx.ALIGN_BOTTOM)
#self.SetDefaultCellOverflow(False)
- #r = wxGridCellAutoWrapStringRenderer()
+ #r = gridlib.GridCellAutoWrapStringRenderer()
#self.SetCellRenderer(9, 1, r)
# overflow cells
self.SetCellEditor(0, 4, editor)
self.SetCellValue(0, 4, "Limited text")
+ renderer = gridlib.GridCellAutoWrapStringRenderer()
+ self.SetCellRenderer(15,0, renderer)
+ self.SetCellValue(15,0, "The text in this cell will be rendered with word-wrapping")
+
# test all the events
self.Bind(gridlib.EVT_GRID_CELL_LEFT_CLICK, self.OnCellLeftClick)
self.Bind(gridlib.EVT_GRID_CELL_RIGHT_CLICK, self.OnCellRightClick)
class TestFrame(wx.Frame):
def __init__(self, parent, log):
wx.Frame.__init__(self, parent, -1, "Simple Grid Demo", size=(640,480))
- grid = SimpleGrid(self, log)
+ self.grid = SimpleGrid(self, log)
if __name__ == '__main__':
import sys
- app = wx.PySimpleApp()
+ from wx.lib.mixins.inspection import InspectableApp
+ app = InspectableApp(False)
frame = TestFrame(None, sys.stdout)
frame.Show(True)
+ #import wx.py
+ #shell = wx.py.shell.ShellFrame(frame, locals={'wx':wx, 'frame':frame})
+ #shell.Show()
app.MainLoop()