Highlight part of contents in a wx.Grid cell

Hello,

I have a wx.Grid and I need to highlight part of the text inside a cell (not the entire contents of the cell). I haven’t found an easy way to achieve that because most APIs apply on the entire contents of the cell.

I’m thinking that the best way to implement this would be to use a custom PyGridCellRenderer that when Draw()ing the contents of the cell will highlight parts of the text.

What do you think? Is there a better/easier way to implement this?

Also, what would be the best way to indirectly call the Draw() method on a cell when I need to highlight a different part of the text? I assume I would have to call a method that changes the look of the cell (e.g. SetCellBackgroundColor, SetCellTextColour etc.)

Thanks!
-Haris

Sir,

In wxpython demo, please see Grid example. There is a module GridStdEdRend.py. In that example you can check out “MyCustomRenderer”, maybe it is what you are looking for.

Best regards

···

On Tuesday, April 8, 2014 12:53:26 AM UTC+3, Haris Andrianakis wrote:

Hello,

I have a wx.Grid and I need to highlight part of the text inside a cell (not the entire contents of the cell). I haven’t found an easy way to achieve that because most APIs apply on the entire contents of the cell.

I’m thinking that the best way to implement this would be to use a custom PyGridCellRenderer that when Draw()ing the contents of the cell will highlight parts of the text.

What do you think? Is there a better/easier way to implement this?

Also, what would be the best way to indirectly call the Draw() method on a cell when I need to highlight a different part of the text? I assume I would have to call a method that changes the look of the cell (e.g. SetCellBackgroundColor, SetCellTextColour etc.)

Thanks!

-Haris