Enhancing ComboBox with bitmaps
The ComboBox
control is similar to a Choice
control, in that it allows us to make a single selection from a pop-up list of options. The list of options is configured as a list of strings, which in some cases may be slightly inconvenient for users to locate the choice they wish to select. This can be alleviated to some extent in certain circumstances by also displaying a related icon next to the choice to help make it more recognizable. In this recipe, we will make a ComboBox
control to select a language option.
How to do it…
Here are the steps that you need to perform:
First, for this recipe we need to import a few submodules, which are as follows:
import wx import wx.lib.langlistctrl as langlist import wx.combo
Next, we will make a subclass of
BitmapComboBox
that enumerates all the possible language options in wxPython:class LanguageComboBox(wx.combo.BitmapComboBox): def __init__(self, parent): super(LanguageComboBox, self).__init__(parent) ...