Hi Jean,
Thank you for your answer. I derive my own grid from wx.grid.Grid,
and set the Highlight pen width in the constructor:
-->--
class AppsGrid(wx.grid.Grid):
def __init__(self, parent):
wx.grid.Grid.__init__(self, parent, id=-1, size=(280,200))
table = AppsDataTable()
self.table = table
self.SetTable(table, True)
self.SetRowLabelSize(0)
self.SetColSize(0,20)
self.SetColSize(1,160)
self.SetColSize(2,74)
self.SetMargins(0,0)
self.EnableDragGridSize(0)
self.SetLabelFont(self.GetCellFont(0,0))
self.SetColLabelSize(22)
self.SetCellHighlightPenWidth(1)
# Make column of application name read-only
attr = wx.grid.GridCellAttr()
attr.SetReadOnly()
self.SetColAttr(1,attr)
wx.grid.EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick)
wx.grid.EVT_GRID_CELL_LEFT_CLICK(self, self.OnLeftClick)
--<--
The trace I get when the interpreter hits the line
self.SetCellHighlightPenWidth(1)
Is:
Traceback (most recent call last):
File "C:\ksta\Sysadmin\Sysadmin.py", line 422, in OnClose
size=(1060,860),
style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE)
File "C:\ksta\Sysadmin\Sysadmin.py", line 233, in __init__
self.MakeMainWindow()
File "C:\ksta\Sysadmin\Sysadmin.py", line 253, in MakeMainWindow
self.tabw = MainTabs(self,-1)
File "C:\ksta\Sysadmin\Sysadmin.py", line 97, in __init__
self.ben = TabUser(sw,mainf)
File "C:\ksta\Sysadmin\TabUser.py", line 479, in __init__
atab = AppsTable(wp)
File "C:\ksta\Sysadmin\AppsTable.py", line 186, in __init__
grid = AppsGrid(self)
File "C:\ksta\Sysadmin\AppsTable.py", line 130, in __init__
self.SetCellHighlightPenWidth(1)
File "C:\Python24\Lib\site-packages\wx-2.6-msw-ansi\wx\grid.py", line
1659, in SetCellHighlightPenWidth
return _grid.Grid_SetCellHighlightPenWidth(*args, **kwargs)
PyAssertionError: C++ assertion "uiIndex < m_nCount" failed in
..\..\include\wx/dynarray.h(812)
Hope this helps clear things up. By the way: Is there some kind of
reference regarding the events that a given control (for example,
Grid) generates? http://www.wxpython.org/docs/api/wx.grid.Grid-class.html
contains no event information.
cheers,
Alex
···
-----Original Message-----
From: Jean Brouwers [mailto:mrjean1@gmail.com]
Sent: Thursday, September 15, 2005 7:59 PM
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] wx.grid.Grid.SetCellHighlightPenWidth(width)
It is hard to tell from the code and tracebck in your message, but
SetCellHighlightPenWidth works fine in our case as follows
import wx, wx.grid as grid
class Agrid(grid.Grid):
...
def SetFocus(self):
grid.Grid.SetCellHighlightPenWidth(self, 1)
...
def OnLostFocus(self, event):
grid.Grid.SetCellHighlightPenWidth(self, 0)
event.Skip()
...
HTH, /Jean Brouwers
On 9/14/05, Suzuki Alex <Alex.Suzuki@ksta.ktzh.ch> wrote:
Hi list,
I'm deriving a custom grid from wxGrid, and I'm not so happy with
the cell-highlighting, the highlight is to wide, aesthetically not
so pleasing. Then I discovered
wx.grid.Grid.SetCellHighlightPenWidth (self, width)
in the documentation, but I get this error message:
[... parent traces ...]
grid = AppsGrid(self)
File "C:\ksta\Sysadmin\AppsTable.py", line 131, in __init__
self.SetCellHighlightPenWidth (1)
File "C:\Python24\Lib\site-packages\wx-2.6-msw-ansi\wx\grid.py", line
1659, in SetCellHighlightPenWidth
return _grid.Grid_SetCellHighlightPenWidth(*args, **kwargs)
PyAssertionError: C++ assertion "uiIndex < m_nCount" failed in
..\..\include\wx/dynarray.h(812)
What am I doing wrong? Any help would be much appreciated. I'm using
wxPython 2.6.1 and Python 2.4.1.
cheers, Alex
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org