Skip to main content

Modern Tkinter utilities for TTK and TTKBootstrap applications

Project description

Vultus Serpentis

Modern Tkinter utilities for TTK and TTKBootstrap applications

Python Version License: MIT

Vultus Serpentis is a suite of integrated utilities for building modern Python Tkinter applications with support for both plain TTK and TTKBootstrap. It provides a clean, modular architecture for common GUI patterns including actions, validation, undo/redo, and event-driven communication.

Features

  • 🎯 Actions: Swing-like Action class for centralizing UI component logic and state
  • Validation: Flexible input validation framework with configurable feedback strategies
  • ↩️ Commands: Robust undo/redo framework based on the command pattern
  • 📡 Event Bus: Synchronous event bus for decoupled component communication
  • 🎨 TTK/TTKBootstrap Support: Works with plain TTK, with enhanced features for TTKBootstrap
  • 🧪 Well-Tested: 90%+ test coverage with comprehensive test suite
  • 📦 Type-Safe: Full type hints with mypy strict mode compliance

Installation

Basic Installation (TTK only)

pip install vultus-serpentis

With TTKBootstrap Support

pip install vultus-serpentis[bootstrap]

Development Installation

pip install vultus-serpentis[dev]

Quick Start

Actions

from vultus_serpentis import Action
import tkinter as tk

def save_file():
    print("File saved!")

root = tk.Tk()
save_action = Action("Save", save_file, tooltip_text="Save the current file")

# Bind to multiple widgets
button = tk.Button(root)
save_action.bind_widget(button)

# Control state centrally
save_action.enabled = False  # Disables all bound widgets

Validation

from vultus_serpentis import ValidationBinder, RequiredValidator
import tkinter as tk

root = tk.Tk()
var = tk.StringVar()
entry = tk.Entry(root, textvariable=var)

# Validate with automatic feedback
with ValidationBinder(entry, var, [RequiredValidator()], debounce_ms=300):
    root.mainloop()

Commands (Undo/Redo)

from vultus_serpentis import Command, CommandManager

class IncrementCommand(Command):
    def __init__(self, counter):
        self.counter = counter
        self.old_value = counter.value
    
    def execute(self):
        self.counter.value += 1
        return True
    
    def undo(self):
        self.counter.value = self.old_value
        return True

manager = CommandManager.default()
manager.execute(IncrementCommand(my_counter))
manager.undo()  # Reverts the increment
manager.redo()  # Re-applies the increment

Event Bus

from vultus_serpentis import EventBus, Event
from dataclasses import dataclass

@dataclass
class FileOpenedEvent(Event):
    filename: str

bus = EventBus.default()

def on_file_opened(event):
    print(f"File opened: {event.filename}")

bus.subscribe(FileOpenedEvent, on_file_opened)
bus.publish(FileOpenedEvent(filename="document.txt"))

Architecture

Vultus Serpentis is designed with modularity in mind. Each module can be used independently or integrated together:

  • common: Shared base classes (Observable, VultusException)
  • events: Event bus for pub/sub messaging
  • commands: Command pattern implementation for undo/redo
  • actions: Action abstraction for UI components
  • validation: Input validation with feedback strategies

TTK vs TTKBootstrap

The library works with plain TTK by default, with enhanced features when TTKBootstrap is available:

Feature Plain TTK TTKBootstrap
Core functionality ✅ Full support ✅ Full support
Validation feedback Basic (bg/fg colors) Enhanced (bootstyle, toast)
Action styling Standard Bootstyle-aware

Development

Running Tests

pytest

Type Checking

mypy vultus_serpentis

Code Quality

pylint vultus_serpentis

Coverage Report

pytest --cov=vultus_serpentis --cov-report=html

Requirements

  • Python 3.9+
  • tksimpletooltip >= 2.6.0
  • ttkbootstrap >= 1.10.0 (optional, for enhanced features)

License

MIT License - see LICENSE file for details

Contributing

Contributions are welcome! Please ensure:

  1. All tests pass (pytest)
  2. Code is type-checked (mypy --strict)
  3. Code follows style guide (pylint)
  4. Test coverage remains above 90%

Roadmap

  • Phase 1: Foundation (Observable, VultusException)
  • Phase 2: Event Bus implementation
  • Phase 3: Command Framework
  • Phase 4: Actions Module
  • Phase 5: Validation Module
  • Phase 6: Integration & Examples
  • Phase 7: Documentation & PyPI Release

Examples

See the examples/ directory for complete working examples:

  • demo_basic_ttk.py: Using Vultus Serpentis with plain TTK
  • demo_bootstrap_enhanced.py: Enhanced features with TTKBootstrap
  • demo_full_integration.py: All modules working together

Support

For issues, questions, or contributions, please visit the GitHub repository.

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

vultus-serpentis-0.1.0.tar.gz (30.3 kB view details)

Uploaded Source

Built Distribution

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

vultus_serpentis-0.1.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file vultus-serpentis-0.1.0.tar.gz.

File metadata

  • Download URL: vultus-serpentis-0.1.0.tar.gz
  • Upload date:
  • Size: 30.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for vultus-serpentis-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5a729a8dc2362a74ab55cbe19631f79a0f5dd80dca0baefa260d032b9bad92cf
MD5 eea4f3e71f60afc1d41305f5c8a532f3
BLAKE2b-256 cb273925459e69e2b8ad9132619c4eb46ed5d8788a827bfe7b694d39a09ff0bc

See more details on using hashes here.

File details

Details for the file vultus_serpentis-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for vultus_serpentis-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b11c257eccf543a50081d5f0dac88cbe6a84df7136871688cf86600e87c0a9b
MD5 4200b1a6281a884b5133ecb72dc8d405
BLAKE2b-256 119e5e2525a3f0530272bba8b0f8fbe3b13dd5be367b329435caa57a21dd9451

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