I am adding images to a ListCtrl but the amount of space that the image would consume is reflected in the header as whitespace… even though I have set the format for the headers to be wx.LIST_FORMAT_LEFT
Any ideas?
parts_list = wx.ListCtrl(parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize,
style=wx.LC_REPORT |wx.BORDER_SUNKEN |wx.LC_ALIGN_LEFT
)
self.il = wx.ImageList(32, 32)
ok = wx.EmptyBitmap(1, 1) # Create a bitmap container object. The size values are dummies.
ok.LoadFile('ok.bmp', wx.BITMAP_TYPE_ANY)
alert = wx.EmptyBitmap(1, 1) # Create a bitmap container object. The size values are dummies.
alert.LoadFile('bad.bmp', wx.BITMAP_TYPE_ANY)
self.ok_icon = self.il.Add(ok)
self.alert_icon = self.il.Add(alert)
parts_list.SetImageList(self.il, wx.IMAGE_LIST_SMALL)
col_num = 0
info = wx.ListItem()
info.m_mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT
info.m_image = -1
info.m_format = wx.LIST_FORMAT_LEFT
for i, header in enumerate(self.parts_col_headers):
info.m_text = header
parts_list.InsertColumnInfo(i, info)
The whitespace is even present in columns that are not the first (where the image resides)
This is even present on the wxPython demo for ListCtrl… the first and third columns have no format set (default left formatting), and if you set the middle to LEFT instead of the RIGHT the demo ships with… you see all columns have the image space wasted in the header