Wxpython 如何扩展wx.grid.GridCellRenderer?

Wxpython 如何扩展wx.grid.GridCellRenderer?,wxpython,wxwidgets,Wxpython,Wxwidgets,这是我的密码。我想重写Draw方法 import wx.grid as gridlib class MyCellRenderer(gridlib.GridCellRenderer): def __init__(self, *args): gridlib.GridCellRenderer.__init__(self, *args) def Draw(self, *args): super(MyCellRender

这是我的密码。我想重写Draw方法

import  wx.grid             as  gridlib

class MyCellRenderer(gridlib.GridCellRenderer):

    def __init__(self, *args):
        gridlib.GridCellRenderer.__init__(self, *args)  

    def Draw(self, *args):
        super(MyCellRenderer,self).Draw(*args)
。。。在脚本的其他部分

        r2 = MyCellRenderer()
        # self is a grid here
        self.SetCellRenderer(15,0, r2)
这是stacktrace

Traceback (most recent call last):
  File "c:\SY_FI\wxPython-2.8.12.1\demo\GridSimple2.py", line 274, in <module>
    frame = TestFrame(None, sys.stdout)
  File "c:\SY_FI\wxPython-2.8.12.1\demo\GridSimple2.py", line 264, in __init__
    self.grid = SimpleGrid(self, log)
  File "c:\SY_FI\wxPython-2.8.12.1\demo\GridSimple2.py", line 96, in __init__
    r2 = MyCellRenderer()
  File "c:\SY_FI\wxPython-2.8.12.1\demo\GridSimple2.py", line 13, in __init__
    gridlib.GridCellRenderer.__init__(self)
  File "D:\ATHENA~1\RELEAS~1\build\ext\vc90_xp/lib\python2.6\site-packages\wx-2.8.12.0\wx\grid.py", line 113, in __init__

AttributeError: No constructor defined
回溯(最近一次呼叫最后一次):
文件“c:\SY\u FI\wxPython-2.8.12.1\demo\GridSimple2.py”,第274行,在
frame=TestFrame(无,sys.stdout)
文件“c:\SY\u-FI\wxPython-2.8.12.1\demo\GridSimple2.py”,第264行,在__
self.grid=SimpleGrid(self,log)
文件“c:\SY\u FI\wxPython-2.8.12.1\demo\GridSimple2.py”,第96行,在u init中__
r2=MyCellRenderer()
文件“c:\SY\u FI\wxPython-2.8.12.1\demo\GridSimple2.py”,第13行,在u init中__
gridlib.GridCellRenderer.\uuuu init\uuuuuu(self)
文件“D:\ATHENA~1\RELEAS~1\build\ext\vc90\u xp/lib\python2.6\site packages\wx-2.8.12.0\wx\grid.py”,第113行,在uu init中__
AttributeError:未定义构造函数

wx的版本是2.8.12.0。python是2.6.6。平台是winxp

我应该从PyGridCellRenderer扩展MyCellRenderer

我应该从PyGridCellRenderer扩展MyCellRenderer