Inheritance diagram for wx.html.HtmlWindow:
wx.html.HtmlWindow is probably the only class you will directly use unless you want to do something special (like adding new tag handlers or MIME filters).
The purpose of this class is to display HTML pages (either local file or downloaded via HTTP protocol) in a window. The width of the window is constant – given in the constructor – and virtual height is changed dynamically depending on page size. Once the window is created you can set its content by calling SetPage, LoadPage or LoadFile.
Window Style | Description |
---|---|
wx.html.HW_SCROLLBAR_NEVER | Never display scrollbars, not even when the page is larger than the window. |
wx.html.HW_SCROLLBAR_AUTO | Display scrollbars only if page’s size exceeds window’s size. |
wx.html.HW_NO_SELECTION | Don’t allow the user to select text. |
Event Name | Description |
---|---|
wx.html.EVT_HTML_CELL_CLICKED(id, func) | A wx.html.HtmlCell was clicked. |
wx.html.EVT_HTML_CELL_HOVER(id, func) | The mouse passed over a wx.html.HtmlCell. |
wx.html.EVT_HTML_LINK_CLICKED(id, func) | A wx.html.HtmlCell which contains an hyperlink was clicked. |
Constructor. All the parameters are the same as wx.ScrolledWindow constructor, except style.
For style, see Window Styles.
Parameters:
Returns:
Adds input filter to the static list of available filters. These filters are present by default:
Parameters:
Appends HTML fragment to currently displayed text and refreshes the window.
Returns False if an error occurred, True otherwise.
Parameters:
Returns:
bool
Returns pointer to the top-level container.
Returns:
Returns anchor within currently opened page (see GetOpenedPage).
If no page is opened or if the displayed page wasn’t produced by call to LoadPage, empty string is returned.
Returns:
string
Returns full location of the opened page.
If no page is opened or if the displayed page wasn’t produced by call to LoadPage, empty string is returned.
Returns:
string
Returns title of the opened page or “” if current page does not contain <TITLE> tag.
Returns:
string
Parameters:
Returns:
bool
Moves back to the previous page.
Each page displayed using LoadPage is stored in history list.
Returns:
bool
Returns True if it is possible to go back in the history (i.e. HistoryBack won’t fail).
Returns:
bool
Returns True if it is possible to go forward in the history (i.e. HistoryForward won’t fail).
Returns:
bool
Moves to next page in history.
Returns:
bool
Loads HTML page from file and displays it.
Returns False if an error occurred, True otherwise.
Parameters:
Returns:
bool
See also
Unlike SetPage this function first loads HTML page from location and then displays it. For example:
htmlWin.LoadPage("help/myproject/index.htm")
Returns False if an error occurred, True otherwise.
Parameters:
Returns:
bool
See also
This method is called when a mouse button is clicked inside wx.html.HtmlWindow.
The default behaviour is to emit a wx.html.HtmlCellEvent and, if the event was not processed or skipped, call OnLinkClicked if the cell contains an hypertext link.
Parameters:
Returns:
bool
Warning
Overloading this method is deprecated; intercept the event instead.
This method is called when a mouse moves over an HTML cell.
Default behaviour is to emit a wx.html.HtmlCellEvent.
Parameters:
Warning
Overloading this method is deprecated; intercept the event instead.
Called when user clicks on hypertext link.
Default behaviour is to emit a wx.html.HtmlLinkEvent and, if the event was not processed or skipped, call LoadPage and do nothing else.
Parameters:
Warning
Overloading this method is deprecated; intercept the event instead.
See also
Called when an URL is being opened (either when the user clicks on a link or an image is loaded).
The URL will be opened only if OnOpeningURL returns wx.html.HTML_OPEN.
You can override OnOpeningURL to selectively block some URLs (e.g. for security reasons) or to redirect them elsewhere.
Default behaviour is to always return wx.html.HTML_OPEN, but if overloaded the possible return values are:
Return Values | Description |
---|---|
wx.html.HTML_OPEN | Open the URL. |
wx.html.HTML_BLOCK | Deny access to the URL. |
wx.html.HTML_REDIRECT | Don’t open url, redirect to another URL. OnOpeningURL must fill redirect with the new URL. OnOpeningURL will be called again on returned URL. |
Parameters:
type (int): Indicates type of the resource. Is one of:
Resource Flag
Description
wx.html.HTML_URL_PAGE
Opening a HTML page.
wx.html.HTML_URL_IMAGE
Opening an image.
wx.html.HTML_URL_OTHER
Opening a resource that doesn’t fall into any other category.
url (string): URL being opened.
redirect (string): string that must be filled with an URL if OnOpeningURL returns wx.html.HTML_REDIRECT.
Returns:
int
Called on parsing <TITLE> tag.
Parameters:
This reads custom settings from wx.Config.
It uses the path path if given, otherwise it saves info into currently selected path. The values are stored in sub-path wx.HtmlWindow.
Read values: all things set by SetFonts, SetBorders.
Parameters:
Parameters:
Returns:
bool
See also
Note
Note that pos is relative to the top of displayed page, not to window’s origin, use CalcUnscrolledPosition to convert physical coordinate.
See also
Note
Note that pos is relative to the top of displayed page, not to window’s origin, use CalcUnscrolledPosition to convert physical coordinate.
See also
Returns current selection as plain text.
Returns empty string if no text is currently selected.
Returns:
string
This function sets the space between border of window and HTML contents. See image:
Parameters:
This function sets font sizes and faces.
Default font sizes are defined by constants wx.html.HTML_FONT_SIZE_1, wx.html.HTML_FONT_SIZE_2, ..., wx.html.HTML_FONT_SIZE_7. Note that they differ among platforms.
Default face names are empty strings.
Parameters:
Sets HTML page and display it. This won’t load the page!! It will display the source. See example:
htmlWin.SetPage("<html><body>Hello, world!</body></html>")
If you want to load a document from some location use LoadPage instead.
Returns False if an error occurred, True otherwise.
Parameters:
Returns:
bool
Sets the frame in which page title will be displayed.
format is format of frame title, e.g. “HtmlHelp : %s”. It must contain exactly one %s. This %s is substituted with HTML page title.
Parameters:
After calling SetRelatedFrame, this sets statusbar slot where messages will be displayed. (Default is -1 = no messages.)
Parameters:
Parameters:
Returns content of currently displayed page as plain text.
Returns:
string
Saves custom settings into wx.Config.
It uses the path path if given, otherwise it saves info into currently selected path. Regardless of whether the path is given or not, the function creates sub-path wx.HtmlWindow.
Saved values: all things set by SetFonts, SetBorders.
Parameters: