list control font in wxPython
I have following code to set the font in list control:
item = wx.ListItem()
font = wx.Font(pointSize=48, family=wx.ROMAN, style=wx.NORMAL, weight=wx.FONTWEIGHT_BOLD,
underline=False, face="", encoding=wx.FONTENCODING_DEFAULT
item.SetFont(font)
item.SetText("hello")
self.list.InsertItem(item)
When I run the above code, the item will display after a blank item. If I remove the font = ...
and item.SetFont(font)
line, the item will display correctly.
Is there anybody can help me?
Thanks开发者_如何学C a lot.
Are you wanting to change the font on all the rows or individually? If you want to do all the rows, then just use the wx.ListCtrl instance's SetFont() method. Otherwise, your method should work. A small runnable example would help us figure this out if you're wanting the latter.
精彩评论