SetRowAttrib help needed ?

Morning,

I have a wx.grid and am trying to change a row background colour, but
am stuck, cant find a list of available wx.grid attributes, ... so
trying things like ...

grid.SetRowAttr(2, grid.SetBackgroundColour,wx.Colour(150, 150, 150))

Also in a wx.grid, if I want one col to expand to use all available
space, which is the best solution ?

Cheers

Dave

···

--

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

Morning,

I have a wx.grid and am trying to change a row background colour, but
am stuck, cant find a list of available wx.grid attributes, ... so
trying things like ...

grid.SetRowAttr(2, grid.SetBackgroundColour,wx.Colour(150, 150, 150))

$ pydoc wx.grid.Grid.SetRowAttr
Help on method SetRowAttr in wx.grid.Grid:

wx.grid.Grid.SetRowAttr = SetRowAttr(*args, **kwargs) unbound wx.grid.Grid method
     SetRowAttr(self, int row, GridCellAttr attr)

You need to create an instance of GridCellAttr to pass to SetRowAttr.

Also in a wx.grid, if I want one col to expand to use all available
space, which is the best solution ?

You could do something similar to the ListCtrlAutoWidthMixin in wx.lib.mixins.listctrl, basically recalculate the size needed to fill the available space in the grid's EVT_SIZE event and then set the column to that size.

···

On 12/25/11 1:35 AM, dave selby wrote:

--
Robin Dunn
Software Craftsman

Morning,

I have a wx.grid and am trying to change a row background colour, but
am stuck, cant find a list of available wx.grid attributes, ... so
trying things like ...

grid.SetRowAttr(2, grid.SetBackgroundColour,wx.Colour(150, 150, 150))

$ pydoc wx.grid.Grid.SetRowAttr
Help on method SetRowAttr in wx.grid.Grid:

wx.grid.Grid.SetRowAttr = SetRowAttr(*args, **kwargs) unbound wx.grid.Grid
method
SetRowAttr(self, int row, GridCellAttr attr)

You need to create an instance of GridCellAttr to pass to SetRowAttr.

OK so I

# TEST CODE
attr = wxgrid.GridCellAttr()
attr.SetBackgroundColour('#00FF00')
grid.SetRowAttr(2, attr)

And it ow works :slight_smile:

Also in a wx.grid, if I want one col to expand to use all available
space, which is the best solution ?

You could do something similar to the ListCtrlAutoWidthMixin in
wx.lib.mixins.listctrl, basically recalculate the size needed to fill the
available space in the grid's EVT_SIZE event and then set the column to that
size.

OK a bit more challenging but got there, was thinking there would be a
simple attribute somewhere !, this wx widget set is pretty cool, my
application is looking good already, even with me being a noobe,

Thanks for your help

Dave

···

On 26 December 2011 18:51, Robin Dunn <robin@alldunn.com> wrote:

On 12/25/11 1:35 AM, dave selby wrote:

--
Robin Dunn
Software Craftsman
http://wxPython.org

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

--

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html