Skip to main content

Typed Python PowerPoint Tool

Project description

🎨 tppt

PyPI version

tppt is a type-safe PowerPoint presentation builder that lets you create stunning presentations with Python code! 🐍

This library is a wrapper around the python-pptx library, providing a more intuitive and type-safe interface for creating PowerPoint presentations. It allows you to build presentations using a builder pattern, making it easy to create slides with various layouts, text formatting, images, and tables.

🚀 Installation

pip install tppt

📚 Documentation

For detailed documentation, please visit Documentation.

🎯 Usage Examples

📝 Basic Presentation Creation

import tppt

# Create a presentation using the builder pattern
presentation = (
    tppt.Presentation.builder()
    # Slide 1: Title and Text
    .slide(
        lambda slide: slide.TitleLayout(
            title="Amazing Presentation",
            subtitle="Example of using tppt library",
        )
    )
    # Slide 2: Text with Formatting
    .slide(
        lambda slide: slide.BlankLayout()
        .builder()
        .text(
            "Amazing Presentation",
            left=(50, "pt"),
            top=(50, "pt"),
            width=(400, "pt"),
            height=(50, "pt"),
            size=(60, "pt"),
            bold=True,
            italic=True,
            color="#0000FF",
        )
        .text(
            "Example of using tppt library",
            left=(50, "pt"),
            top=(120, "pt"),
            width=(400, "pt"),
            height=(30, "pt"),
        )
    )
    # Slide 3: Image
    .slide(
        lambda slide: slide.BlankLayout()
        .builder()
        .text(
            "Python Logo Example",
            left=(50, "pt"),
            top=(50, "pt"),
            width=(300, "pt"),
            height=(40, "pt"),
        )
        .picture(
            "python-logo.png",
            left=(50, "pt"),
            top=(100, "pt"),
            width=(300, "pt"),
            height=(80, "pt"),
        )
    )
    # Slide 4: Table
    .slide(
        lambda slide: slide.BlankLayout()
        .builder()
        .text(
            "Table Example",
            left=(50, "pt"),
            top=(50, "pt"),
            width=(300, "pt"),
            height=(40, "pt"),
        )
        .table(
            [
                ["Product", "Price", "Stock"],
                ["Product A", "$10.00", "10 units"],
                ["Product B", "$25.00", "5 units"],
            ],
            left=(50, "pt"),
            top=(100, "pt"),
            width=(400, "pt"),
            height=(200, "pt"),
        )
    )
    .build()
)

# Save the presentation
presentation.save("output.pptx")

✨ Features

  • 🛡️ Type-safe interface with comprehensive type hints
  • 🏗️ Intuitive API using the builder pattern
  • 🎨 Flexible slide layouts (Title, Title and Content, Blank)
  • 📝 Rich text formatting capabilities:
    • 🅰️ Font size, bold, italic
    • 🎨 Custom colors
    • 🎯 Advanced text formatting through custom functions
  • 🖼️ Image support with precise positioning
  • 📊 Table creation with customizable dimensions
  • 📏 Fine-grained control over element positioning and sizing
  • 🎭 Support for custom slide masters

📜 License

MIT

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

tppt-0.3.0.tar.gz (407.2 kB view details)

Uploaded Source

Built Distribution

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

tppt-0.3.0-py3-none-any.whl (50.8 kB view details)

Uploaded Python 3

File details

Details for the file tppt-0.3.0.tar.gz.

File metadata

  • Download URL: tppt-0.3.0.tar.gz
  • Upload date:
  • Size: 407.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tppt-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1d75a424b4fc5d4d6088a9e6a41330cd405c6c81c1642d19767afff90c65948c
MD5 06a2ca63726010dcfe6d644824b1f241
BLAKE2b-256 e42d5468614d75d5374365496f4d5072c9b903016b71e904e91cba8cdd491ee2

See more details on using hashes here.

File details

Details for the file tppt-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: tppt-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 50.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tppt-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c057a1b75ad6fc2ec98e4847c2fe4022d6c8968c16e11f6301ca07d66f48a9d6
MD5 c573a3cbbd23ecc6da1a710f22bdf54b
BLAKE2b-256 c8100b21946ade12e923f8f4b2660d2627607c8ccf6c3db7e385ad941333a92d

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