wx.html.HtmlListBox is an implementation of wx.VListBox which shows HTML content in the listbox rows.
This is still an abstract base class and you will need to derive your own class from it (see htlbox sample for the example), but you will only need to override a single wx.html.HtmlListBox.OnGetItem
function.
^^
Handlers bound for the following event types will receive one of the wx.html.HtmlCellEvent wx.html.HtmlLinkEvent parameters.
EVT_HTML_CELL_CLICKED: A wx.html.HtmlCell was clicked.
EVT_HTML_CELL_HOVER: The mouse passed over a wx.html.HtmlCell.
EVT_HTML_LINK_CLICKED: A wx.html.HtmlCell which contains a hyperlink was clicked. ^^
wx.richtext.RichTextStyleListBox, wx.html.SimpleHtmlListBox
Normal constructor which calls |
|
Creates the control and optionally sets the initial number of items in it (it may also be set or changed later with |
|
Returns the wx.FileSystem used by the HTML parser of this object. |
|
This virtual function may be overridden to change the appearance of the background of the selected cells in the same way as |
|
This virtual function may be overridden to customize the appearance of the selected cells. |
|
This method must be implemented in the derived class and should return the body (i.e. without |
|
This function may be overridden to decorate HTML returned by |
|
Called when the user clicks on hypertext link. |
See |
wx.html.
HtmlListBox
(VListBox)¶Possible constructors:
HtmlListBox(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize,
style=0, name=HtmlListBoxNameStr)
HtmlListBox()
HtmlListBox is an implementation of VListBox which shows HTML content in the listbox rows.
__init__
(self, *args, **kw)¶__init__ (self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=0, name=HtmlListBoxNameStr)
Normal constructor which calls Create
internally.
__init__ (self)
Default constructor, you must call Create
later.
Create
(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=0, name=HtmlListBoxNameStr)¶Creates the control and optionally sets the initial number of items in it (it may also be set or changed later with wx.VListBox.SetItemCount
).
There are no special styles defined for wx.html.HtmlListBox, in particular the wx.ListBox styles (with the exception of LB_MULTIPLE
) cannot be used here.
Returns True
on success or False
if the control couldn’t be created
GetClassDefaultAttributes
(variant=WINDOW_VARIANT_NORMAL)¶variant (WindowVariant) –
VisualAttributes
GetFileSystem
(self)¶Returns the wx.FileSystem used by the HTML parser of this object.
The file system object is used to resolve the paths in HTML fragments displayed in the control and you should use wx.FileSystem.ChangePathTo
if you use relative paths for the images or other resources embedded in your HTML.
GetSelectedTextBgColour
(self, colBg)¶This virtual function may be overridden to change the appearance of the background of the selected cells in the same way as GetSelectedTextColour
.
It should be rarely, if ever, used because wx.VListBox.SetSelectionBackground
allows changing the selection background for all cells at once and doing anything more fancy is probably going to look strangely.
colBg (wx.Colour) –
Colour
See also
GetSelectedTextColour
(self, colFg)¶This virtual function may be overridden to customize the appearance of the selected cells.
It is used to determine how the colour colFg is going to look inside selection. By default all original colours are completely ignored and the standard, system-dependent, selection colour is used but the program may wish to override this to achieve some custom appearance.
colFg (wx.Colour) –
Colour
OnGetItem
(self, n)¶This method must be implemented in the derived class and should return the body (i.e. without html
nor body
tags) of the HTML fragment for the given item.
Note that this function should always return a text fragment for the n item which renders with the same height both when it is selected and when it’s not: i.e. if you call, inside your OnGetItem
implementation, IsSelected(n)
to make the items appear differently when they are selected, then you should make sure that the returned HTML fragment will render with the same height or else you’ll see some artifacts when the user selects an item.
n (int) –
string
OnGetItemMarkup
(self, n)¶This function may be overridden to decorate HTML returned by OnGetItem
.
n (int) –
string
OnLinkClicked
(self, n, link)¶Called when the user clicks on hypertext link.
Does nothing by default. Overloading this method is deprecated; intercept the event instead.
n (int) – Index of the item containing the link.
link (wx.html.HtmlLinkInfo) – Description of the link.
See also
FileSystem
¶See GetFileSystem