Skip to main content

A modern Python terminal utility library with text effects, loading animations, spinners, progress bars, and interactive input.

Project description

✨ Ter-FX 2.0.0

Build beautiful terminal applications with ease.

Ter-FX is a lightweight, beginner-friendly Python package for building modern terminal applications. Whether you're creating shell emulators, installers, command-line tools, automation scripts, or games, Ter-FX provides colorful output, logging, terminal effects, system utilities, and command decorators to make development simple.


Features

  • 🎨 ANSI color support
  • 🖨️ Colored terminal printing
  • ⌨️ Interactive input
  • 🔢 Number input validation
  • 🔒 Hidden password input
  • 📍 Centered text
  • ⌛ Typewriter effect
  • 🌀 Animated spinners
  • 📊 Progress bars
  • ⏳ Loading screens
  • 📝 Logging utilities
  • 💻 Built-in system utilities
  • 🧩 Command decorator
  • ⚡ Lightweight
  • 🐍 Pure Python

Installation

pip install ter-fx

Quick Start

from terfx import console

console.printin("Hello, World!", "green")

Output

Hello, World!

Importing

Import everything:

from terfx import *

Or import only what you need:

from terfx import console, log, sys, cmd

Console

Print Text

console.printin("Hello!", "green")

Typewriter Effect

console.printout(
    "Welcome to Ter-FX!",
    "cyan",
    speed=0.03
)

User Input

name = console.input(
    "Enter your name: ",
    "yellow"
)

Number Input

age = console.numinput(
    "Enter your age: "
)

Supports both integers and decimal numbers.


Password Input

password = console.passinput(
    "Password: "
)

Center Text

console.printcenter(
    "Welcome!",
    "magenta"
)

Effects

Spinner

console.spinner(
    "Loading",
    3,
    "cyan"
)

Loading Screen

console.loadscr(
    "Installing",
    5,
    "green"
)

Progress Bar

for i in range(101):
    console.progress(i, 100)

Log

Info

log.info("Connecting...")

Success

log.success("Connected!")

Warning

log.warning("Low memory!")

Error

log.error("Connection failed!")

Debug

log.debug("Variable x = 42")

Sys

The new sys module provides simple wrappers around common operating system tasks.

Run Commands

sys.cmd("ipconfig")

Capture command output:

output = sys.cmd(
    "ipconfig",
    capture=True
)

print(output)

Clear Terminal

sys.clear()

Current Directory

print(sys.cwd())

Change Directory

sys.chdir("Documents")

List Files

print(sys.listdir())

Check if a File Exists

if sys.exists("hello.txt"):
    log.success("File found!")

Create a Folder

sys.mkdir("Projects")

Rename

sys.rename(
    "old.txt",
    "new.txt"
)

Copy

sys.copy(
    "main.py",
    "backup.py"
)

Move

sys.move(
    "backup.py",
    "Archive/"
)

Command Decorator

Ter-FX includes the @cmd decorator for creating clean command handlers.

from terfx import cmd

@cmd
def hello(parts):
    print(parts[0])
    print(parts[1])
    print(parts.rest)

hello(["hello", "world"])

Output

hello
world
['world']

The decorator automatically converts the argument list into a Part object.

Part provides:

Property Description
parts[0] First argument
parts[1] Second argument
parts.count Number of arguments
parts.rest Remaining arguments
len(parts) Number of arguments

Example:

@cmd
def install(parts):

    if parts.count < 2:
        log.error("No package supplied.")
        return

    package = parts[1]

    if package == "dir":
        log.success("Installing directory package...")

Available Colors

black
red
green
yellow
blue
magenta
cyan
white

Example

console.printin(
    "Blue Text",
    "blue"
)

Complete Example

from terfx import *

console.printcenter(
    "Ter-FX 2.0 Demo",
    "cyan"
)

name = console.input(
    "Enter your name: ",
    "green"
)

console.printout(
    f"Welcome {name}!",
    "yellow"
)

console.spinner(
    "Loading",
    2
)

for i in range(101):
    console.progress(i, 100)

sys.clear()

log.success("Finished!")

Requirements

  • Python 3.9+
  • Windows
  • Linux
  • macOS

Roadmap

Planned features:

  • Tables
  • Boxes
  • Menus
  • Terminal UI Widgets
  • RGB Colors
  • Cursor Control
  • Text Styling
  • Better CLI Framework
  • More Decorators
  • File Utilities
  • Networking Utilities

Contributing

Contributions are welcome!

You can help by:

  • Reporting bugs
  • Suggesting new features
  • Improving documentation
  • Optimizing performance
  • Creating examples

License

This project is licensed under the MIT License.


Author

Faizan-ur-Rahim

Created with ❤️ using Python.

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

ter_fx-1.1.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

ter_fx-1.1.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file ter_fx-1.1.0.tar.gz.

File metadata

  • Download URL: ter_fx-1.1.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for ter_fx-1.1.0.tar.gz
Algorithm Hash digest
SHA256 7433b28686800ffec3413e4513a36c5ff7ff6a186dfe0a881500e5bd4538e326
MD5 cbd22209d95bb9acf24e65db63cd973e
BLAKE2b-256 8d797bab445c5139b5654f8ffd2ff369deadec95f9eafbd45af8acd03bda9f48

See more details on using hashes here.

File details

Details for the file ter_fx-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: ter_fx-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for ter_fx-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f253291b233a3ea1e81cb51992f4adc180c060e90b9941bc798f3768f8f834f9
MD5 0c58f36f301dc08491a5ceeb30402334
BLAKE2b-256 a1c0fef4034e46b6f1d93d25accca11dffa6ffe53b346d6a049523eaaf22b46a

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