from wxPython.wx import *
from wxPython.grid import *
-import string, random
+import random
#---------------------------------------------------------------------------
dc.SetBackgroundMode(wxSOLID)
dc.SetBrush(wxBrush(wxBLACK, wxSOLID))
dc.SetPen(wxTRANSPARENT_PEN)
- dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height)
+ dc.DrawRectangleRect(rect)
dc.SetBackgroundMode(wxTRANSPARENT)
dc.SetFont(attr.GetFont())
text = grid.GetCellValue(row, col)
- colors = [wxRED, wxWHITE, wxCYAN]
+ colors = ["RED", "WHITE", "SKY BLUE"]
x = rect.x + 1
y = rect.y + 1
for ch in text:
dc.SetTextForeground(random.choice(colors))
- dc.DrawText(ch, x, y)
+ dc.DrawText(ch, (x, y))
w, h = dc.GetTextExtent(ch)
x = x + w
if x > rect.right - 5:
('wxGridCellBoolEditor', '1', wxGridCellBoolEditor, ()),
('wxGridCellChoiceEditor', 'one', wxGridCellChoiceEditor, (['one', 'two', 'three', 'four',
'kick', 'Microsoft', 'out the',
- 'door'], false)),
+ 'door'], False)),
]
row = 2
for label, value, renderClass, args in rendererDemoData:
- renderer = apply(renderClass, args)
+ renderer = renderClass(*args)
self.SetCellValue(row, renCol, label)
self.SetCellValue(row, renCol+1, value)
self.SetCellRenderer(row, renCol+1, renderer)
row = 2
for label, value, editorClass, args in editorDemoData:
- editor = apply(editorClass, args)
+ editor = editorClass(*args)
self.SetCellValue(row, edCol, label)
self.SetCellValue(row, edCol+1, value)
self.SetCellEditor(row, edCol+1, editor)
for label, value, renClass, edClass in comboDemoData:
self.SetCellValue(row, renCol, label)
self.SetCellValue(row, renCol+1, value)
- editor = apply(edClass, ()) #args)
- renderer = apply(renClass, ()) #args)
+ editor = edClass()
+ renderer = renClass()
self.SetCellEditor(row, renCol+1, editor)
self.SetCellRenderer(row, renCol+1, renderer)
row = row + 2
attr = wxGridCellAttr()
attr.SetFont(font)
attr.SetBackgroundColour(wxLIGHT_GREY)
- attr.SetReadOnly(true)
+ attr.SetReadOnly(True)
attr.SetAlignment(wxRIGHT, -1)
self.SetColAttr(renCol, attr)
attr.IncRef()
self.SetColAttr(edCol, attr)
# There is a bug in wxGTK for this method...
- if wxPlatform != '__WXGTK__':
- self.AutoSizeColumns(true)
- self.AutoSizeRows(true)
+ self.AutoSizeColumns(True)
+ self.AutoSizeRows(True)
EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick)
import sys
app = wxPySimpleApp()
frame = TestFrame(None, sys.stdout)
- frame.Show(true)
+ frame.Show(True)
app.MainLoop()