Web View¶
The Web View widget is used for displaying an embedded browser window within an application
Usage¶
import toga
web = toga.WebView(url='https://google.com')
Reference¶
-
class
toga.interface.widgets.webview.
WebView
(id=None, style=None, url=None, on_key_down=None, on_webview_load=None)¶ Web view widget
Instantiate a new instance of the tree widget
Parameters: - id (
str
) – An identifier for this widget. - style (
colosseum.CSSNode
) – an optional style object. If no style is provided then a new one will be created for the widget. - url (
str
) – The URL to start with - on_key_down (
callable
) – The callback method for when the a key is pressed within the web view - on_webview_load (
callable
) – The callback method for when the webview loads (or reloads)
-
add
(child)¶ Add a widget as a child of this one.
Raises an
ValueError
if this widget is a leaf, and cannot have children.Parameters: child ( toga.Widget
) – The child to add to the widget
-
app
¶ The App to which this widget belongs.
Return type: toga.App
-
children
¶ The children of this node.
This always returns a list, even if the node is a leaf and cannot have children.
Return type: list
Returns: A list of the children for this widget
-
dom
¶ The current DOM
Return type: str
-
evaluate
(javascript)¶ Evaluate a JavaScript expression
Parameters: javascript ( str
) – The javascript expression
-
hide
()¶ Hide the widget from the super view.
-
id
¶ The node identifier. This id can be used to target CSS directives
Return type: str
-
parent
¶ The parent of this node.
Return type: toga.Widget
-
set_content
(root_url, content)¶ Set the content of the web view
Parameters: - root_url (
str
) – The URL - content (
str
) – The new content
- root_url (
-
set_font
(font)¶ Set a font on this widget.
Parameters: font ( toga.Font
) – The new font
-
show
()¶ Show the widget on the super view.
-
style
¶ The style object for this widget.
Returns: The style for this widget Return type: colosseum.CSSNode
-
url
¶ The current URL
Return type: str
-
window
¶ The Window to which this widget belongs.
Return type: toga.Window
- id (