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 Bootstrap (and other frameworks in the future) 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:

    • Download NW.js.
    • Or use the PyBootstrapUI command:
      python -m pybootstrapui download %path_to_nwjs%
      

📝 Basic Usage

📄 Creating a Page

from pybootstrapui import Page
from pybootstrapui.components import Header, Button, BootstrapIcon
from pybootstrapui.modifiers import *

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

# Add components
page.add(Header(BootstrapIcon('box-seam-fill'), "Welcome to PyBootstrapUI!"))
page.add(Button(label="Click Me", modifier=ButtonModifier.color(ButtonStyle.PRIMARY)))

# Generate HTML
print(page.compile())

🔄 Adding Callbacks

import asyncio
from pybootstrapui import Page, ButtonCallbackContext
from pybootstrapui.components import Header, Button, ButtonStyle
from pybootstrapui.templates import Default


# Define a callback function
async def on_button_click(context: ButtonCallbackContext):
    context.show_spinner()
    
    print(f"Button clicked with ID: {context.id}")
    await asyncio.sleep(15)
    
    context.hide_spinner()


# Create a page with a button callback
page = Page(page_title="Callback Demo")
page.add(Header("Dynamic Callbacks Example"))
page.add(Button("Click Me", modifier=ButtonModifier.color(ButtonStyle.SUCCESS), on_click=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

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

# Add components
page.add(Header("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
)

📦 Easy Packaging

Easily package and distribute your PyBootstrapUI applications with minimal effort!

🛠️ Step 1: Create a New Project

Generate a fully templated PyBootstrapUI project structure:

python -m pybootstrapui create MyProject

⚙️ Step 2: Build Your Application

Package your application into a standalone build:

python -m pybootstrapui build MyProject
  • Dependencies Management: All required packages are bundled.
  • Optimized Build Process: Ensures efficient and clean packaging.
  • Platform-Specific Binaries: Create executables for Windows, macOS, or Linux seamlessly.

🚀 Migration to PyBootstrapUI 1.1.0

For a detailed step-by-step migration guide, refer to the official tutorial:
👉 Migrating to v1.1.0

This guide covers all the key updates and examples to help you transition smoothly.


📚 Documentation

Detailed documentation is available at PyBootstrapUI Docs (WIP).


🔗 Useful Links


📜 License

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


✨ Start building beautiful, dynamic, and cross-platform applications with PyBootstrapUI today! 🚀

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.1.1.tar.gz (70.1 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.1.1-py3-none-any.whl (127.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pybootstrapui-1.1.1.tar.gz
  • Upload date:
  • Size: 70.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pybootstrapui-1.1.1.tar.gz
Algorithm Hash digest
SHA256 e700722150ac1c886cdbbfff141d3be2d3f1443b1b58b2080d3d285695961f84
MD5 c9aa1f4309b4b378eed06bc21d7182a7
BLAKE2b-256 1b06cece20bfe8e3199aca298309f8d0e22213b9d201dc61d80cc6741e230be5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pybootstrapui-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 127.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pybootstrapui-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 365f0d0cea8ca1546a0bce87ebd8cf34c904051d98ce6339efecdfe464c62537
MD5 f0ea0e0ba9c83d823d168d8555c1fba3
BLAKE2b-256 3a3cd221d24a15088f844a82082ad10cc48736c611717cfcc464773d4fb3ca94

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