DesktopApp#

class toui.apps.DesktopApp(name='App', assets_folder=None)[source]#

Bases: _App

A class that create a desktop application from HTML files.

name#

The name of the app

Type:

str

pages#

A list of added Page objects.

Type:

list

user_vars#

A normal dictionary. It was created only to make the API for the Website class and DesktopApp class similar.

Type:

dict

Examples

Creating a desktop app:

>>> from toui import DesktopApp
>>> app = DesktopApp("MyApp")

Creating a page and adding it to the app:

>>> from toui import Page
>>> home_page = Page(html_str="<h1>This is the home page</h1>")
>>> app.add_pages(home_page)

Running the app:

>>> if __name__ == "__main__":
...     app.run() 
Parameters:

name (str) – The name of the app.

Methods#

toui.apps.DesktopApp.add_pages

Adds pages to the app.

toui.apps.DesktopApp.get_user_page

Returns the current Page.

toui.apps.DesktopApp.open_new_page

Opens a new window that has the specified URL.

toui.apps.DesktopApp.run

Runs the app.