Wx Grid: How to override GetRowGridLinePen and GetColGridLinePen
Sanjeev
sankoz at gmail.com
Sat Nov 3 04:32:36 PDT 2007
Hi,
Contrary to the documentation, I am not able to set the Grid lines with
different thickness by overriding the the GetRowGridLinePen and
GetColGridLinePen methods.
I am running wxPython 2.8.4.0 (gtk2-unicode) and Python 2.5.1 (r251:54863, Oct
5 2007, 13:36:32)on Ubuntu 7.10
Please see my example code below. The two print statements in the code are not
getting hit! Could you please tell me what is missing here.
Thanks,
Sanjeev
#!/usr/bin/python
import string
import wx
from wx.grid import Grid
class myGrid(Grid):
def __init__(self, parent, id):
Grid.__init__(self, parent,id, wx.Point(10,10),
wx.Size(400,200),wx.TE_MULTILINE)
def GetRowGridLinePen(self, row):
print "calling GetRowGridLinePen"
if row % 3 == 0:
return wx.Pen(wx.BLACK, 1, wx.SOLID)
else:
return self.GetDefaultGridLinePen()
def GetColGridLinePen(self, col):
print "calling GetColGridLinePen"
if col % 3 == 0:
return wx.Pen(wx.BLACK, 1, wx.SOLID)
else:
return self.GetDefaultGridLinePen()
class myPanel(wx.Panel):
def __init__(self, parent, id):
wx.Panel.__init__(self, parent, id)
self.output = myGrid(self,6)
self.output.CreateGrid(3,3)
class myFrame(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(400, 200))
self.panel = myPanel(self, -1)
self.Show(True)
app = wx.App()
myFrame(None, -1, 'Example')
app.MainLoop()
More information about the wxpython-users
mailing list