use different fonts in a single wx.ListItem

I have a wx.ListCtrl in wx.LC_REPORT style. I would need to have different font styles in a single wx.ListItem.
More specifically, I have a string item in which some part of the string should be bold.

The only code I found so far is:

item = listCtrl.GetItem(1)
font = item.GetFont()
font.SetWeight(wx.FONTWEIGHT_BOLD)
item.SetFont(font)
listCtrl.SetItem(item)

This just makes the whole row bold.
When I use

item = listCtrl.GetItem(1, 1)

instead of the first line it even doesn’t highlight the string item at position (1,1) at all, as I would have expected :frowning:

Well, it seems that wx.ListCtrl doesn’t support to change the font of a single wx.ListItem in a list row, nor does it support different fonts within a single wx.ListItem.
Does anyone have an idea how to achieve different font styles in a single wx.ListItem of a wx.ListCtrl ?

Thanks,
Sam

···

Werden Sie Mitglied der neuen Windows Live Messenger Familie! Hier klicken!

Samuel Lipp wrote:

Well, it seems that wx.ListCtrl doesn't support to change the font of a single wx.ListItem in a list row, nor does it support different fonts within a single wx.ListItem.
Does anyone have an idea how to achieve different font styles in a single wx.ListItem of a wx.ListCtrl ?

wx.ListCtrl can't do it. You can do things like this with wx.grid.Grid however, and there are some things you can do to make the grid act a little more like a ListCtrl. In 2.9+ you'll be able to do this with the new DataViewCtrl.

···

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