I am developing an application for a laboratory experiment on human
behaviour in eocnomics.
I am using the Icon ListCtrl (horizontally aligned) to display the
number of players that are in a given situation.
Visually, I have a matrix with a cell for each possible situation. In
the upper part of the matrix, I wanted to display the number of
subject that fall into that category as a list of 'user icons' with a
number.
The wx.ListCtrl works through the creation of a wx.ImageList that
gets asigend to the ListCtrl
I have two problems with this otherwise very handy solution:
1. I am not succeedng in disabling (greying-out) the ListCtrl. Or,
better said: when calling wx.ListCtrl.Enabled I get 'False'; but,
nonetheless (and as you can see) the icons are still in full colour
and are not greyed-out. I see that wx.ImageList has no function
Disable(), and that might be the reason. In any case: how do I disable
a wx.ListCtrl which has been assigned a wx.ImageList?
2. As you can see in the screenshot, There is a space below the row of
icons. It is as if the list needs two rows for the icons, or as if it
keeps space for not-shown labels. I would like to get rid of this
extra space. Is there any way to do it?
self.il = wx.ImageList(22,22, True)
for name in play_in_cell:
self.bmp = wx.Bitmap(PlayIcons[name], wx.BITMAP_TYPE_PNG)
self.il_max = self.il.AddWithColourMask(self.bmp,'black')
self.list.AssignImageList(self.il, wx.IMAGE_LIST_NORMAL)
for x in range(len(play_in_cell)):
self.img = x % (self.il_max+1)
self.list.InsertImageItem(x, self.img)
self.list.SetItemPosition(x, (2+(x-1)*26,2))
the list is a child of a class Matrix, that subclasses wx.Panel; when
I call Matrix.Disable() it disables all children, included the
ListCtrl; but it seems unable to Disable the ImageList assigned to the
ListCtrl.
I am developing an application for a laboratory experiment on human
behaviour in eocnomics.
I am using the Icon ListCtrl (horizontally aligned) to display the
number of players that are in a given situation.
Visually, I have a matrix with a cell for each possible situation. In
the upper part of the matrix, I wanted to display the number of
subject that fall into that category as a list of 'user icons' with a
number.
The wx.ListCtrl works through the creation of a wx.ImageList that
gets asigend to the ListCtrl
I have two problems with this otherwise very handy solution:
1. I am not succeedng in disabling (greying-out) the ListCtrl. Or,
better said: when calling wx.ListCtrl.Enabled I get 'False'; but,
nonetheless (and as you can see) the icons are still in full colour
and are not greyed-out. I see that wx.ImageList has no function
Disable(), and that might be the reason. In any case: how do I disable
a wx.ListCtrl which has been assigned a wx.ImageList?
IIRC the wx.ListCtrl shows disabled state simply by changing the color of the selection and perhaps the text, the icons are not touched. If you want them to be greyed out then you'll need to add a second set of icons to the image list and then change the image ID for each item to/from the disabled set.
2. As you can see in the screenshot, There is a space below the row of
icons. It is as if the list needs two rows for the icons, or as if it
keeps space for not-shown labels. I would like to get rid of this
extra space. Is there any way to do it?
Probably not. The wx.ListCtrl will always assume that items can have a label and will calculate the space needed according to that. Are you sure that the wx.ListCtrl is the best choice for your UI?