Skip to main content

Windows-only Python SDK for rendering JSON Schema forms in WebView2

Project description

XBot Form

Python 3.8+ License: MIT Windows

Windows-only Python SDK for rendering JSON Schema forms in WebView2.

Features

  • 🎨 JSON Schema Forms - Render dynamic forms from JSON Schema definitions
  • 🖥️ Native Windows UI - Uses WebView2 for modern, native-feeling interfaces
  • 🎯 Type-Safe API - Configuration classes with IDE autocompletion support
  • 🔗 Fluent Builder - Chainable API for easy form configuration
  • 🌙 Theme Support - Light and dark mode themes
  • 🪟 Frameless Windows - Optional borderless windows with rounded corners

Installation

pip install xbot-form

Requirements:

  • Windows 10/11
  • Python 3.8+
  • WebView2 Runtime (usually pre-installed on Windows 10/11)

Quick Start

Basic Usage

from xbot_form import show_form, FormCancelledError

schema = {
    "type": "object",
    "properties": {
        "name": {"type": "string", "title": "Name"},
        "email": {"type": "string", "title": "Email", "format": "email"},
    },
    "required": ["name", "email"]
}

try:
    result = show_form(schema=schema, title="User Registration")
    print(f"User submitted: {result}")
except FormCancelledError:
    print("User cancelled the form")

Builder Pattern (Recommended)

from xbot_form import form_builder, FormCancelledError

try:
    result = (
        form_builder()
        .schema({
            "type": "object",
            "properties": {
                "username": {"type": "string", "title": "Username"},
                "password": {"type": "string", "title": "Password"},
            }
        })
        .ui_schema({
            "password": {"ui:widget": "password"}
        })
        .title("Login")
        .size(600, 400)
        .frameless(corner_radius=16)
        .theme("dark")
        .show()
    )
    print(f"Login: {result}")
except FormCancelledError:
    print("Login cancelled")

Configuration Classes

from xbot_form import (
    show_form_with_config,
    FormConfig,
    WindowOptions,
    DisplayOptions,
    FormCancelledError
)

config = FormConfig(
    schema={
        "type": "object",
        "properties": {
            "task": {"type": "string", "title": "Task Name"},
            "priority": {
                "type": "string",
                "title": "Priority",
                "enum": ["Low", "Medium", "High"]
            }
        }
    },
    window=WindowOptions(
        width=800,
        height=600,
        title="New Task",
        frameless=True,
        corner_radius=12
    ),
    display=DisplayOptions(
        theme="light",
        debug=False
    )
)

try:
    result = show_form_with_config(config)
    print(f"Task created: {result}")
except FormCancelledError:
    print("Cancelled")

API Reference

Functions

Function Description
show_form(...) Display a form with individual parameters
show_form_with_config(config) Display a form using FormConfig object
form_builder() Create a FormBuilder for fluent configuration

Configuration Classes

Class Description
FormConfig Complete form configuration
FormSchema JSON Schema with optional UI schema
WindowOptions Window size, title, frameless settings
DisplayOptions Theme, debug mode, locale settings
FormBuilder Fluent builder for form configuration

Exceptions

Exception Description
XBotFormError Base exception for all SDK errors
FormCancelledError User cancelled or closed the form
FormTimeoutError Form display timed out
WebViewError WebView2 initialization error
WebViewNotAvailableError WebView2 runtime not installed
WindowError Window creation error

Parameters

show_form()

Parameter Type Default Description
schema dict None JSON Schema for the form
title str None Window title
width int 1000 Window width in pixels
height int 800 Window height in pixels
frameless bool False Borderless window mode
corner_radius int 0 Corner radius for frameless windows
debug bool False Enable DevTools
theme str "light" Color theme ("light" or "dark")

License

MIT License - see LICENSE 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

xbot_form-0.2.2.tar.gz (352.9 kB view details)

Uploaded Source

Built Distribution

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

xbot_form-0.2.2-py3-none-any.whl (357.3 kB view details)

Uploaded Python 3

File details

Details for the file xbot_form-0.2.2.tar.gz.

File metadata

  • Download URL: xbot_form-0.2.2.tar.gz
  • Upload date:
  • Size: 352.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.2 Windows/11

File hashes

Hashes for xbot_form-0.2.2.tar.gz
Algorithm Hash digest
SHA256 0b006211425d70aa00e9f2361fa8b4f0d1fc88ecc27c866dc6efb99ac3e3e8e9
MD5 7887bb04c02219b75d71766cd27bd17a
BLAKE2b-256 e8377ba769d1e230bfe49b3cfab207b3298dc1a5aa2cc515a2b9f77b4c49a1eb

See more details on using hashes here.

File details

Details for the file xbot_form-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: xbot_form-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 357.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.2 Windows/11

File hashes

Hashes for xbot_form-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 42c4253247a514b5c83c186ae0e8ee76d5430f53bc5ceecbe51a2a1e96d8e5c4
MD5 314a08f47b51527949e65aa0aa32c3d2
BLAKE2b-256 f238e020eb7025d082723d49a82717c70bcdf81355d05f8c2c48719b0d984ec2

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