X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..3fe5f176be5ec2a3ea30ea8ecdd2b343fa89f27c:/wxPython/demo/GridStdEdRend.py diff --git a/wxPython/demo/GridStdEdRend.py b/wxPython/demo/GridStdEdRend.py index 5835a8227e..e5e144b84a 100644 --- a/wxPython/demo/GridStdEdRend.py +++ b/wxPython/demo/GridStdEdRend.py @@ -1,7 +1,7 @@ from wxPython.wx import * from wxPython.grid import * -import string, random +import random #--------------------------------------------------------------------------- @@ -13,18 +13,18 @@ class MyCustomRenderer(wxPyGridCellRenderer): 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: @@ -60,7 +60,7 @@ editorDemoData = [ ('wxGridCellBoolEditor', '1', wxGridCellBoolEditor, ()), ('wxGridCellChoiceEditor', 'one', wxGridCellChoiceEditor, (['one', 'two', 'three', 'four', 'kick', 'Microsoft', 'out the', - 'door'], false)), + 'door'], False)), ] @@ -107,7 +107,7 @@ Renderers used together. 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) @@ -116,7 +116,7 @@ Renderers used together. 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) @@ -127,8 +127,8 @@ Renderers used together. 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 @@ -139,15 +139,15 @@ Renderers used together. 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) @@ -174,7 +174,7 @@ if __name__ == '__main__': import sys app = wxPySimpleApp() frame = TestFrame(None, sys.stdout) - frame.Show(true) + frame.Show(True) app.MainLoop()