wx.html.HtmlTag¶This class represents a single HTML tag.
It is used by tag handlers.
Class Hierarchy¶
Inheritance diagram for class HtmlTag:

Methods Summary¶Returns a string containing all parameters. |
|
Returns tag’s name. |
|
Returns the value of the parameter. |
|
Interprets tag parameter par as colour specification and saves its value into wx.Colour variable pointed by clr. |
|
Interprets tag parameter par as an integer and saves its value into int variable pointed by value. |
|
Get the value of the parameter. |
|
Returns |
|
Returns |
|
Parses the given string as an HTML colour. |
Properties Summary¶See |
|
See |
Class API¶wx.html.HtmlTag(object)¶This class represents a single HTML tag.
GetAllParams(self)¶Returns a string containing all parameters.
Example: tag contains <FONT SIZE=+2 COLOR=”#000000”>. Call to tag.GetAllParams() would return 'SIZE=+2 COLOR=”#000000”’.
string
GetName(self)¶Returns tag’s name.
The name is always in uppercase and it doesn’t contain “ or ‘/’ characters. (So the name of <FONT SIZE=+2> tag is “FONT” and name of </table> is “TABLE”).
string
GetParam(self, par, with_quotes=False)¶Returns the value of the parameter.
You should check whether the parameter exists or not (use wx.html.HtmlTag.HasParam ) first or use GetParamAsString if you need to distinguish between non-specified and empty parameter values.
par (string) – The parameter’s name.
with_quotes (bool) – True if you want to get quotes as well. See example.
string
# ... Some code here...
# you have wx.HtmlTag variable tag which is equal to the
# HTML tag <FONT SIZE=+2 COLOR="#0000FF">
dummy = tag.GetParam("SIZE")
# dummy == "+2"
dummy = tag.GetParam("COLOR")
# dummy == "#0000FF"
dummy = tag.GetParam("COLOR", true)
# dummy == "\"#0000FF\"" -- see the difference!!
GetParamAsColour(self, par)¶Interprets tag parameter par as colour specification and saves its value into wx.Colour variable pointed by clr.
Returns True on success and False if par is not colour specification or if the tag has no such parameter.
par (string) –
tuple
( bool, clr )
See also
GetParamAsInt(self, par)¶Interprets tag parameter par as an integer and saves its value into int variable pointed by value.
Returns True on success and False if par is not an integer or if the tag has no such parameter.
par (string) –
tuple
( bool, value )
GetParamAsString(self, par, value)¶Get the value of the parameter.
If the tag doesn’t have such parameter at all, simply returns False. Otherwise, fills value with the parameter value and returns True.
par (string) – The parameter’s name.
value (string) – Pointer to the string to be filled with the parameter value, must be not None.
bool
New in version 3.0.
HasEnding(self)¶Returns True if this tag is paired with ending tag, False otherwise.
See the example of HTML document:
<html><body>
Hello<p>
How are you?
<p align=center>This is centered...</p>
Oops<br>Oooops!
</body></html>
In this example tags HTML and BODY have ending tags, first P and BR doesn’t have ending tag while the second P has. The third P tag (which is ending itself) of course doesn’t have ending tag.
bool
HasParam(self, par)¶Returns True if the tag has a parameter of the given name.
Example: <FONT SIZE=+2 COLOR=”\#FF00FF”> has two parameters named “SIZE” and “COLOR”.
par (string) – the parameter you’re looking for.
bool
ParseAsColour(str)¶Parses the given string as an HTML colour.
This function recognizes the standard named HTML 4 colours as well as the usual RGB syntax.
str (string) –
tuple
( bool, clr )
New in version 2.9.1.
See also
AllParams¶See GetAllParams