I’m experimenting with the look* of a wxListCtrl and wondered if I can set the font for the column headers different to the text of the list items. So far, it doesn’t appear to work. I’m trying this:
#Set the font of the listCtrl itself, therefore the header columns text, to 10px:
#Set the font of an individual list item t0 14px:
item_int = self.listCtrl1.InsertStringItem(self.num_of_rows,self.mytext)
item_itself = self.listCtrl1.GetItem(item_int)
item_itself.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL,
False, u'Arial'))
But it seems the first SetFont dominates. Am I doing it wrongly?
I wanted the smaller font for the header because larger fonts look rather cramped.
(*But now that I see how ugly Gmail and its black subject line bar of mandatrory high contrast has become, maybe I’m silly to worry about aesthetics? ;D )
I'm experimenting with the look* of a wxListCtrl and wondered if I can
set the font for the column headers different to the text of the list
items. So far, it doesn't appear to work. I'm trying this:
#Set the font of the listCtrl itself, therefore the header columns text,
to 10px:
self.listCtrl1.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL,
False, u'Arial'))
#Set the font of an individual list item t0 14px:
item_int =
self.listCtrl1.InsertStringItem(self.num_of_rows,self.mytext)
item_itself = self.listCtrl1.GetItem(item_int)
item_itself.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL,
False, u'Arial'))
But it seems the first SetFont dominates. Am I doing it wrongly?
The item returned from GetItem is just a copy of the real item in the listctrl, so you would have to update the internal item with the item you've edited. But there is an easier way:
That's a good tip, thanks. The problem now is if I set the font of the
listCtrl itself to something (to set the headers) and then I use
SetItemFont() as you suggested, to make the item fonts larger than that,
the height of the rows are not sufficient to fit the text height: the
bottoms of "y" and "g" and other letters with a hanging bit are cut off.
Based on some other considerations, I might try UltimateListCtrl as well,
and so perhaps can go that route.
···
On Fri, Aug 23, 2013 at 9:11 PM, Robin Dunn <robin@alldunn.com> wrote:
The item returned from GetItem is just a copy of the real item in the
listctrl, so you would have to update the internal item with the item
you've edited. But there is an easier way: