Package: toui
OverviewToUI is a Python framework for creating user interfaces (web apps and desktop apps) from HTML code easily. It allows you to call your Python functions from HTML. No JavaScript knowledge is required, but some knowledge of HTML is usually required.Why ToUIConverts HTML and CSS files into a fast-responsive app using Python alone.Simple to understand for programmers who only know Python and HTML.Edit HTML files dynamically.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.Contains features that will greatly support you while creating your apps, such as:Sign-in featureUser-specific databaseUploading and downloading filesGoogle sign in (experimental)Firebase (experimental)Password protection for your appPreviewCalling a Python function from HTML codeSimple calculatorFollow the link below to preview a live app created using ToUI:https://toui-92bd1594dbed.herokuapp.com/To download this template and customize to create your own web app, go to thissection.How to installRun this command:pipinstalltouiTo install only the required dependencies, run these commands:pipinstall--no-depstoui
toui--minimal-reqsHow to create a basic websiteImport the required classes:fromtouiimportWebsite,PageCreate aWebsiteobject:app=Website(name=__name__,assets_folder="path/to/assets_folder",secret_key="some secret key")Create aPageand 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:fromtouiimportWebsite,Pageapp=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 appCreating a desktop app is similar to creating a website. Only replaceWebsiteclass withDesktopApp:fromtouiimportDesktopApp,Pageapp=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()Start with a templateTo start with a basic template for a ToUI project. Run the command:toui initYou can find the same templatehere.To start with a full template that includes aHomepage, anAboutpage,Contactpage, a simpleCalculatorpage, aSign-inpage (includingGoogle sign-in), a simpleDashboard, and more, run the following command:toui init --fullYou can also find the full templatehere. Additionally, you can find a live preview of the template in this link:https://toui-92bd1594dbed.herokuapp.com/Make the app responsiveCheck thisexampleandother examplesto learn how
to make the website / desktop app responsive.Deploy the appYou can deploy the web app the same way you deploy aFlaskapp (How to deploy Flask app).
The only difference is that you need to access theFlaskobject first:app=Website(__name__)flask_app=app.flask_appThen you need to deploy theflask_appand not theapp.How to contributeToUI welcomes contribution, small or big. For anyone who wants to contribute please check thecontribution page.License and CopyrightsCopyrights (c) 2023 Mubarak Almehairbi.
This package is licensed under the MIT license.DocumentationYou can find the documentation in this link:ToUI docs.