Skip to main content

A Python library for building web interfaces with dynamic and desktop features.

Project description

PyBootstrapUI

PyBootstrapUI is a Python framework for building modern web interfaces, integrating HTML components, dynamic user interactions, and creating desktop applications powered by NW.js.


Key Features

  • Dynamic UI: Build interactive web pages with server-side callbacks for user events.
  • Desktop Applications: Launch web pages as standalone desktop apps using NW.js.
  • Prebuilt Components: Access a library of ready-to-use HTML components like buttons, headers, forms, modals, and more.
  • Custom Templates: Use predefined themes or your own HTML templates for quick styling.
  • Seamless Integration: Works well with FastAPI and Bootstrap for modern web development.

Quick Start

Installation

  1. Install the package:

    pip install pybootstrapui
    
  2. Install NW.js if you plan to build desktop applications:


Basic Usage

Creating a Page

from pybootstrapui import Page
from pybootstrapui.components import Header, Button
from pybootstrapui.templates import Default

# Create a new page
page = Page(template_filename=Default, page_title="Hello PyBootstrapUI")

# Add components
page.add(Header(label="Welcome to PyBootstrapUI!", header_size=1))
page.add(Button(label="Click Me", btn_style_type="primary"))

# Generate HTML
print(page.compile())

Adding Callbacks

from pybootstrapui import Page
from pybootstrapui.components import Header, Button
from pybootstrapui.templates import Default

# Define a callback function
def on_button_click(context):
    print(f"Button clicked with ID: {context.id}")

# Create a page with a button callback
page = Page(template_filename=Default, page_title="Callback Demo")
page.add(Header(label="Dynamic Callbacks Example"))
page.add(Button(label="Click Me", btn_style_type="primary", callback=on_button_click))

# Run as a desktop application
page.run_in_desktop(
    nwjs_path="/path/to/nwjs",
    title="Callback App",
    width=800,
    height=600
)

Running as a Desktop App

Use the Page.run_in_desktop method to run your page as a desktop application.

from pybootstrapui import Page
from pybootstrapui.components import Header
from pybootstrapui.templates import Default

# Create the page
page = Page(template_filename=Default, page_title="My App")

# Add components
page.add(Header(label="This is a desktop app!"))

# Run the app
page.run_in_desktop(
    nwjs_path="/path/to/nwjs",
    icon="icon.png",
    title="My Desktop App",
    width=1024,
    height=768
)

Documentation

Comprehensive documentation is available at PyBootstrapUI Docs.


Links


License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

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

Source Distribution

pybootstrapui-1.0.7.tar.gz (51.8 kB view details)

Uploaded Source

Built Distribution

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

pybootstrapui-1.0.7-py3-none-any.whl (108.2 kB view details)

Uploaded Python 3

File details

Details for the file pybootstrapui-1.0.7.tar.gz.

File metadata

  • Download URL: pybootstrapui-1.0.7.tar.gz
  • Upload date:
  • Size: 51.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.6

File hashes

Hashes for pybootstrapui-1.0.7.tar.gz
Algorithm Hash digest
SHA256 ee9e71c09612fe64079511b6a6fa7d979c5c59116e1451f311e0e660a2eb8dc7
MD5 43532322d8105c723c942723bd4ee25c
BLAKE2b-256 fa07a09a67a566179edf3cfc4aef84b5de7fac2b1abb5bfaf9f1d8109acd1ee7

See more details on using hashes here.

File details

Details for the file pybootstrapui-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: pybootstrapui-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 108.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.6

File hashes

Hashes for pybootstrapui-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 6a6ae33cbc0371f9b220dd3ad2850241cde3abb905e279be79afaedee767021d
MD5 2640e96d5d0839f391dcf9b8922b4b46
BLAKE2b-256 4edfb5156c8de84507ab97d75bfd7d7488a87b4fda7574cc58c8f0e114fcde6c

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