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¶This class represents a single HTML tag.
Returns a string containing all parameters.
Example: tag contains <FONT SIZE=+2 COLOR=â#000000â>. Call to tag.GetAllParams() would return 'SIZE=+2 COLOR=â#000000ââ.
str
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â).
str
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.
str
# ... 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!!
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)
le[bool, wx.Colour]
See also
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, int]
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
Added in version 3.0.
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
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
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)
le[bool, wx.Colour]
True if the string was successfully parsed and clr was filled with the result or False otherwise.
Added in version 2.9.1.
See also
See GetAllParams