Grid: which colours are available ; how to change column header font ?

Hi Guys,

Two questions on wx.grid.Grid:

  1. Where can I find a list of colours available for text inside grid cells ?
    Googling, I found that (e.g.) the following works:

self.grid.SetCellTextColour(row,col,wx.RED)

But I could not find a list of all colours
available for SetCellTextColour().

  1. How can I change grid’s column heading font attributes ?
    Namely, how can I change the font to non-bold, or to make it smaller ?
    Thanks,

Ron.

Hi Ron,

Hi Guys,
Two questions on wx.grid.Grid:

   1. Where can I find a list of colours available for _text_ inside
      grid cells ?
      Googling, I found that (e.g.) the following works:

      self.grid.SetCellTextColour(row,col,wx.RED)

The 3rd argument can be a wx.Colour instance, so you can use wx.RED, "red" or the HTML hex format I think. See the docs for more info:

http://www.wxpython.org/docs/api/wx.Colour-class.html

  1.

      But I could not find a list of _all colours_ available for
      SetCellTextColour().
   2. How can I change grid's column heading font attributes ?
      Namely, how can I change the font to non-bold, or to make it
      smaller ?

According to the wxPython book, you should be able to use SetLabelFont(font) to change the font of row and column labels. I'm not sure if this affect both columns AND rows or not. You might also try SetColLabelSize(height)

···

Thanks,
Ron.

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

Barak, Ron wrote:

Hi Guys,
Two questions on wx.grid.Grid:

   1. Where can I find a list of colours available for _text_ inside
      grid cells ?
      Googling, I found that (e.g.) the following works:

      self.grid.SetCellTextColour(row,col,wx.RED)

      But I could not find a list of _all colours_ available for
      SetCellTextColour().

$ pydoc wx.Colour
Help on class Colour in wx:

wx.Colour = class Colour(wx._core.Object)
  > A colour is an object representing a combination of Red, Green, and
  > Blue (RGB) intensity values, and is used to determine drawing colours,
  > window colours, etc. Valid RGB values are in the range 0 to 255.
  >
  > In wxPython there are typemaps that will automatically convert from a
  > colour name, from a '#RRGGBB' colour hex value string, or from a 3 or 4
  > integer tuple to a wx.Colour object when calling C++ methods that
  > expect a wxColour. This means that the following are all
  > equivallent::
  >
  > win.SetBackgroundColour(wxColour(0,0,255))
  > win.SetBackgroundColour('BLUE')
  > win.SetBackgroundColour('#0000FF')
  > win.SetBackgroundColour((0,0,255))
  >
  > Additional colour names and their coresponding values can be added
  > using `wx.ColourDatabase`. Various system colours (as set in the
  > user's system preferences) can be retrieved with
  > `wx.SystemSettings.GetColour`.
  >

   2. How can I change grid's column heading font attributes ?
      Namely, how can I change the font to non-bold, or to make it smaller ?

SetLabelFont

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thanks Robin: excellent answer.
Bye,
Ron.

···

-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: Saturday, November 01, 2008 03:38
To: wxpython-users@lists.wxwidgets.org
Subject: Re: [wxpython-users] Grid: which colours are available ; how to change column header font ?

Barak, Ron wrote:

Hi Guys,

Two questions on wx.grid.Grid:

   1. Where can I find a list of colours available for _text_ inside
      grid cells ?
      Googling, I found that (e.g.) the following works:

      self.grid.SetCellTextColour(row,col,wx.RED)

      But I could not find a list of _all colours_ available for
      SetCellTextColour().

$ pydoc wx.Colour
Help on class Colour in wx:

wx.Colour = class Colour(wx._core.Object)
  > A colour is an object representing a combination of Red, Green, and
  > Blue (RGB) intensity values, and is used to determine drawing colours,
  > window colours, etc. Valid RGB values are in the range 0 to 255.
  >
  > In wxPython there are typemaps that will automatically convert from a
  > colour name, from a '#RRGGBB' colour hex value string, or from a 3 or 4
  > integer tuple to a wx.Colour object when calling C++ methods that
  > expect a wxColour. This means that the following are all
  > equivallent::
  >
  > win.SetBackgroundColour(wxColour(0,0,255))
  > win.SetBackgroundColour('BLUE')
  > win.SetBackgroundColour('#0000FF')
  > win.SetBackgroundColour((0,0,255))
  >
  > Additional colour names and their coresponding values can be added
  > using `wx.ColourDatabase`. Various system colours (as set in the
  > user's system preferences) can be retrieved with
  > `wx.SystemSettings.GetColour`.
  >

   2. How can I change grid's column heading font attributes ?
      Namely, how can I change the font to non-bold, or to make it smaller ?

SetLabelFont

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!