wx.html.HtmlWinParser¶This class is derived from wx.html.HtmlParser and its main goal is to parse HTML input so that it can be displayed in wx.html.HtmlWindow.
It uses a special wx.html.HtmlWinTagHandler.
Note
The product of parsing is a wx.html.HtmlCell (resp. HtmlContainer) object.
See also
Class Hierarchy¶
Inheritance diagram for class HtmlWinParser:

Methods Summary¶Constructor. |
|
Closes the container, sets actual container to the parent one and returns pointer to it (see Cells and Containers). |
|
Creates font based on current setting (see |
|
Returns actual text colour. |
|
Returns default horizontal alignment. |
|
Returns (average) int height in standard font. |
|
Returns average int width in standard font. |
|
Returns pointer to the currently opened container (see Cells and Containers). |
|
Returns pointer to the DC used during parsing. |
|
Returns |
|
Returns actual font face name. |
|
Returns |
|
Returns |
|
Returns actual font size (HTML size varies from -2 to +4) |
|
Returns |
|
Returns actual hypertext link. |
|
Returns the colour of hypertext link text. |
|
Returns associated window ( wx.html.HtmlWindow). |
|
Opens new container and returns pointer to it (see Cells and Containers). |
|
Sets actual text colour. |
|
Sets default horizontal alignment (see |
|
Allows you to directly set opened container. |
|
Sets the DC. |
|
Sets bold flag of actualfont. |
|
Sets current font face to face. |
|
Sets fixed face flag of actualfont. |
|
Sets italic flag of actualfont. |
|
Sets actual font size (HTML size varies from 1 to 7). |
|
Sets underlined flag of actualfont. |
|
Sets fonts. |
|
Sets actual hypertext link. |
|
Sets colour of hypertext link. |
Properties Summary¶See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
Class API¶wx.html.HtmlWinParser(HtmlParser)¶Possible constructors:
HtmlWinParser(wndIface=None)
This class is derived from HtmlParser and its main goal is to parse HTML input so that it can be displayed in HtmlWindow.
__init__(self, wndIface=None)¶Constructor.
Don’t use the default one, use the constructor with wndIface parameter (wndIface is a pointer to interface object for the associated wx.html.HtmlWindow or other HTML rendering window such as wx.html.HtmlListBox).
wndIface (wx.html.HtmlWindowInterface) –
CloseContainer(self)¶Closes the container, sets actual container to the parent one and returns pointer to it (see Cells and Containers).
CreateCurrentFont(self)¶Creates font based on current setting (see SetFontSize , SetFontBold , SetFontItalic , SetFontFixed , wx.html.HtmlWinParser.SetFontUnderlined ) and returns pointer to it.
If the font was already created only a pointer is returned.
Font
GetActualColor(self)¶Returns actual text colour.
Colour
GetAlign(self)¶Returns default horizontal alignment.
int
GetCharHeight(self)¶Returns (average) int height in standard font.
It is used as DC-independent metrics.
int
Note
This function doesn’t return the actual height. If you want to know the height of the current font, call GetDC-> GetCharHeight .
GetCharWidth(self)¶Returns average int width in standard font.
It is used as DC-independent metrics.
int
Note
This function doesn’t return the actual width. If you want to know the height of the current font, call GetDC-> GetCharWidth .
GetContainer(self)¶Returns pointer to the currently opened container (see Cells and Containers).
Common use:
self.WParser.GetContainer().InsertCell(html_cell)
GetFontBold(self)¶Returns True if actual font is bold, False otherwise.
int
GetFontFace(self)¶Returns actual font face name.
string
GetFontFixed(self)¶Returns True if actual font is fixed face, False otherwise.
int
GetFontItalic(self)¶Returns True if actual font is italic, False otherwise.
int
GetFontSize(self)¶Returns actual font size (HTML size varies from -2 to +4)
int
GetFontUnderlined(self)¶Returns True if actual font is underlined, False otherwise.
int
GetLink(self)¶Returns actual hypertext link.
(This value has a non-empty wx.html.HtmlLinkInfo.GetHref Href string if the parser is between <A> and </A> tags, “” otherwise.)
GetLinkColor(self)¶Returns the colour of hypertext link text.
Colour
GetWindowInterface(self)¶Returns associated window ( wx.html.HtmlWindow).
This may be None! (You should always test if it is not None. For example TITLE handler sets window title only if some window is associated, otherwise it does nothing.
OpenContainer(self)¶Opens new container and returns pointer to it (see Cells and Containers).
SetActualColor(self, clr)¶Sets actual text colour.
Note: this DOESN’T change the colour! You must create wx.html.HtmlColourCell yourself.
clr (wx.Colour) –
SetAlign(self, a)¶Sets default horizontal alignment (see wx.html.HtmlContainerCell.SetAlignHor ).
Alignment of newly opened container is set to this value.
a (int) –
SetContainer(self, c)¶Allows you to directly set opened container.
This is not recommended - you should use OpenContainer wherever possible.
SetDC(self, dc, pixel_scale=1.0e+0)¶Sets the DC.
This must be called before wx.html.HtmlParser.Parse !
pixel_scale can be used when rendering to high-resolution DCs (e.g. printer) to adjust size of pixel metrics. (Many dimensions in HTML are given in pixels – e.g. image sizes. 300x300 image would be only one inch wide on typical printer. With pixel_scale = 3.0 it would be 3 inches.)
dc (wx.DC) –
pixel_scale (float) –
SetFontBold(self, x)¶Sets bold flag of actualfont.
x is either True of False.
x (int) –
SetFontFace(self, face)¶Sets current font face to face.
This affects either fixed size font or proportional, depending on context (whether the parser is inside <TT> tag or not).
face (string) –
SetFontFixed(self, x)¶Sets fixed face flag of actualfont.
x is either True of False.
x (int) –
SetFontItalic(self, x)¶Sets italic flag of actualfont.
x is either True of False.
x (int) –
SetFontSize(self, s)¶Sets actual font size (HTML size varies from 1 to 7).
s (int) –
SetFontUnderlined(self, x)¶Sets underlined flag of actualfont.
x is either True of False.
x (int) –
SetFonts(self, normal_face, fixed_face, sizes)¶Sets fonts.
See wx.html.HtmlWindow.SetFonts for detailed description.
normal_face (string) –
fixed_face (string) –
sizes (list of integers) –
SetLink(self, link)¶Sets actual hypertext link.
Empty link is represented by wx.html.HtmlLinkInfo with Href equal to “”.
link (wx.html.HtmlLinkInfo) –
ActualColor¶See GetActualColor and SetActualColor
CharHeight¶See GetCharHeight
CharWidth¶See GetCharWidth
Container¶See GetContainer and SetContainer
FontBold¶See GetFontBold and SetFontBold
FontFace¶See GetFontFace and SetFontFace
FontFixed¶See GetFontFixed and SetFontFixed
FontItalic¶See GetFontItalic and SetFontItalic
FontSize¶See GetFontSize and SetFontSize
FontUnderlined¶See GetFontUnderlined and SetFontUnderlined
LinkColor¶See GetLinkColor and SetLinkColor
WindowInterface¶