[wxpython-users] wx.Grid and writing a custom column renderer

Paul M¢Nett p at ulmcnett.com
Sat Apr 5 20:06:03 PDT 2008


gioacchinomauri at libero.it wrote:
> Hi There,
> 
> I'm using wxpython 2.8 with python 2.5. I need a component similar to wx.Grid but i want that two columns could share the same header.
> 
> Example:
> 
> |Pizzas            |
> --------------------
> |Quantity | Price  | 
> |         |        |
> 
> 
> Is there a way for customize in a EASY WAY the wx.Grid component for doing that ? In the demo of wxpython there are examples about the customization of cell renderers but this is not what i need.

For EASY WAY, I'd suggest making it one column, and formatting the data 
to be 'Quantity @ Price' ("1 @ 17.99").

Otherwise, you can get a reference to the grid header window 
(grid.GetGridColLabelWindow()) and catch its paint event and draw 
whatever you want.


Paul


More information about the wxpython-users mailing list