Skip to main content

Visual effects for Textual, a TermincalTextEffects wrapper.

Project description

textualeffects

Visual effects for Textual, a TerminalTextEffects wrapper.

Intro

textualeffects is a library that provides Textual bindings for the excellent TerminalTextEffects visual effects library.

Widgets

There are two widgets available in textualeffects, EffectLabel and SplashScreen.

An EffectLabel widget that can be used to display text with a visual effect.

from textual.app import App, ComposeResult

from textualeffects.effects import EffectType
from textualeffects.widgets import EffectLabel

text=("Hello World! " * 5 + "\n") * 10,
effect: EffectType = "Spotlights"
config = {
    "search_duration": 500,
    "spotlight_count": 3,
}


class TextualEffect(App):

    def compose(self) -> ComposeResult:
        label = EffectLabel(text, effect=effect, config=config)
        label.styles.border = ("heavy", "green")
        yield label


if __name__ == "__main__":
    app = TextualEffect()
    app.run()

EffectLabel

A SplashScreen widget that can be used to display a splash screen based on ModalScreen with a visual effect. Once the effect is complete, the splash screen will be dismissed.

from textual.app import App, ComposeResult
from textual.widgets import TextArea

from textualeffects.effects import EffectType
from textualeffects.widgets import SplashScreen

effect: EffectType = "Spotlights"
config = {
    "search_duration": 100,
    "spotlight_count": 3,
}


class SplashEffect(App):

    def on_mount(self) -> None:
        text = ("Hello World! " * 5 + "\n") * 10
        self.push_screen(SplashScreen(text, effect=effect, config=config))

    def compose(self) -> ComposeResult:
        yield TextArea(("Main content" * 5 + "\n") * 10)


if __name__ == "__main__":
    app = SplashEffect()
    app.run()

Both widgets accept the following arguments:

  • text: The text to display.
  • effect: The visual effect to apply to the text. Available effects are exposed through the EffectType type.
  • config: A dictionary of configuration options for the effect. The available options depend on the effect. Detailed information on the available options can be found in the TerminalTextEffects documentation.

License

This project is licensed under the MIT License.

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

textualeffects-0.1.1.tar.gz (3.2 MB view details)

Uploaded Source

Built Distribution

textualeffects-0.1.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file textualeffects-0.1.1.tar.gz.

File metadata

  • Download URL: textualeffects-0.1.1.tar.gz
  • Upload date:
  • Size: 3.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.16

File hashes

Hashes for textualeffects-0.1.1.tar.gz
Algorithm Hash digest
SHA256 86833ef011dec6fa3643db6094b574d872b29dee56e80818cabfe41200986b76
MD5 dc1e273a91b103200b313074ebab9562
BLAKE2b-256 a214b5d68b9503800f752c85b5f909805e0f020e835b9b1816e78f302397f371

See more details on using hashes here.

File details

Details for the file textualeffects-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for textualeffects-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bd6284d71d4b466b1d04040d9b9284198da3ca8b030bdc09968cb7749ea9e25e
MD5 372e73541f962c1ed61c1ddccb5b25e8
BLAKE2b-256 5222ddb15f92c5fdf3d2e7c6e377020932738cfc8f66406f2881841729016aca

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page