wx.html.SimpleHtmlListBox is an implementation of wx.html.HtmlListBox which shows HTML content in the listbox rows.
Unlike wx.html.HtmlListBox, this is not an abstract class and thus it has the advantage that you can use it without deriving your own class from it. However, it also has the disadvantage that this is not a virtual control and thus it’s not well-suited for those cases where you need to show a huge number of items: every time you add/insert a string, it will be stored internally and thus will take memory.
The interface exposed by wx.html.SimpleHtmlListBox fully implements the wx.ControlWithItems interface, thus you should refer to wx.ControlWithItems’s documentation for the API reference for adding/removing/retrieving items in the listbox. Also note that the wx.VListBox.SetItemCount
function is protected
in wx.html.SimpleHtmlListBox’s context so that you cannot call it directly, wx.html.SimpleHtmlListBox will do it for you.
Note: in case you need to append a lot of items to the control at once, make sure to use the Append
function.
Thus the only difference between a wx.ListBox and a wx.html.SimpleHtmlListBox is that the latter stores strings which can contain HTML fragments (see the list of tags supported by wxHTML).
Note that the HTML strings you fetch to wx.html.SimpleHtmlListBox should not contain the <html>
or <body>
tags.
^^
This class supports the following styles:
wx.html.HLB_DEFAULT_STYLE
: The default style: wx.BORDER_SUNKEN
wx.html.HLB_MULTIPLE
: Multiple-selection list: the user can toggle multiple items on and off. ^^
A wx.html.SimpleHtmlListBox emits the same events used by wx.ListBox and by wx.html.HtmlListBox.
^^
Event macros for events emitted by this class:
EVT_LISTBOX: Process a wxEVT_LISTBOX
event, when an item on the list is selected. See wx.CommandEvent.
EVT_LISTBOX_DCLICK: Process a wxEVT_LISTBOX_DCLICK
event, when the listbox is double-clicked. See wx.CommandEvent.
EVT_HTML_CELL_CLICKED: A wx.html.HtmlCell was clicked. See wx.html.HtmlCellEvent.
EVT_HTML_CELL_HOVER: The mouse passed over a wx.html.HtmlCell. See wx.html.HtmlCellEvent.
EVT_HTML_LINK_CLICKED: A wx.html.HtmlCell which contains a hyperlink was clicked. See wx.html.HtmlLinkEvent ^^
Constructor, creating and showing the HTML list box. |
|
Creates the HTML listbox for two-step construction. |
|
wx.html.
SimpleHtmlListBox
(HtmlListBox, ItemContainer)¶Possible constructors:
SimpleHtmlListBox(parent, id=ID_ANY, pos=DefaultPosition,
size=DefaultSize, choices=[], style=HLB_DEFAULT_STYLE,
validator=DefaultValidator, name=SimpleHtmlListBoxNameStr)
SimpleHtmlListBox()
SimpleHtmlListBox is an implementation of HtmlListBox which shows HTML content in the listbox rows.
__init__
(self, *args, **kw)¶__init__ (self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, choices=[], style=HLB_DEFAULT_STYLE, validator=DefaultValidator, name=SimpleHtmlListBoxNameStr)
Constructor, creating and showing the HTML list box.
parent (wx.Window) – Parent window. Must not be None
.
id (wx.WindowID) – Window identifier. A value of -1 indicates a default value.
pos (wx.Point) – Window position.
size (wx.Size) – Window size. If DefaultSize is specified then the window is sized appropriately.
choices (list of strings) – An array of strings with which to initialise the control.
style (long) – Window style. See HLB_
flags.
validator (wx.Validator) – Window validator.
name (string) – Window name.
__init__ (self)
Default constructor, you must call Create
later.
Create
(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, choices=[], style=HLB_DEFAULT_STYLE, validator=DefaultValidator, name=SimpleHtmlListBoxNameStr)¶Creates the HTML listbox for two-step construction.
See wx.html.SimpleHtmlListBox for further details.
parent (wx.Window) –
id (wx.WindowID) –
pos (wx.Point) –
size (wx.Size) –
choices (list of strings) –
style (long) –
validator (wx.Validator) –
name (string) –
bool
GetClassDefaultAttributes
(variant=WINDOW_VARIANT_NORMAL)¶variant (WindowVariant) –
VisualAttributes