Skip to main content

Creates user interfaces (websites and desktop apps) from HTML easily

Reason this release was yanked:

This version contains a security vulnerability. You can read about it in this link: https://github.com/mubarakalmehairbi/ToUI/security/advisories/GHSA-hh7j-pg39-q563. Please use it with caution or upgrade to v2.4.1.

Project description

ToUI Image

Overview

ToUI is a Python package for creating user interfaces (websites and desktop apps) from HTML easily. No JavaScript knowledge is required, but some knowledge of HTML is usually required.

Why ToUI

  • Converts HTML files into a responsive app.
  • Simple to understand for programmers who only know Python and HTML.
  • The method of creating websites and the method of creating desktop apps are similar, which makes it easy to convert a website to a desktop app and vice versa.

How to install

Run this command:

pip install toui

How to create a basic website

Import the required classes:

from toui import Website, Page

Create a Website object:

app = Website(name=__name__, assets_folder="path/to/assets_folder",  secret_key="some secret key")

Create a Page and add it to the website:

main_page = Page(html_file="path/to/html", url="/")
app.add_pages(main_page)

Run the app:

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

The complete code:

from toui import Website, Page

app = Website(name=__name__, assets_folder="path/to/assets_folder", 
              secret_key="some secret key")

main_page = Page(html_file="path/to/html", url="/")
app.add_pages(main_page)

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

How to create a desktop app

Creating a desktop app is similar to creating a website. Only replace Website class with DesktopApp:

from toui import DesktopApp, Page

app = DesktopApp(name="MyApp", assets_folder="path/to/assets_folder")

main_page = Page(html_file="path/to/html", url="/")
app.add_pages(main_page)

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

Make the app responsive

Check this example and other examples to learn how to make the website / desktop app responsive.

Deploy the app

You can deploy the web app the same way you deploy a Flask app (How to deploy Flask app). The only difference is that you need to access the Flask object first:

app = Website(__name__)
flask_app = app.flask_app

Then you need to deploy the flask_app and not the app.

License and Copyrights

Copyrights (c) 2023 Mubarak Almehairbi. This package is licensed under the MIT license.

Documentation

You can find the documentation in this link: ToUI docs.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

toui-2.1.0.tar.gz (54.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

toui-2.1.0-py3-none-any.whl (29.9 kB view details)

Uploaded Python 3

File details

Details for the file toui-2.1.0.tar.gz.

File metadata

  • Download URL: toui-2.1.0.tar.gz
  • Upload date:
  • Size: 54.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for toui-2.1.0.tar.gz
Algorithm Hash digest
SHA256 ec20961977771f9d2f757dc60a3b47267ce39db432517c78164fc68a16a59f58
MD5 2e277de165fa6c4c42ebd5c3cb212fb2
BLAKE2b-256 b97880aa764c9eeff2f258c98b6094e781e5de1d0d8f0ffb235c6eeabb77ca55

See more details on using hashes here.

File details

Details for the file toui-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: toui-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for toui-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7cf7225acbcf1551e67aa6190f380bc632c21744b12fa27ba3bf4af20a42d138
MD5 be564624fb2a6fff303ec1a896eaa242
BLAKE2b-256 239d88e607ecc428e5e073d0576d7d62ccaa814418f9713661c38fb83b8191c6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page