ANSI console control utility
Project description
🕷️ ragnetto-console
Ragnetto-Console is a lightweight Python utility for terminal manipulation using ANSI escape sequences
It provides an easy-to-use interface for colors, cursor positioning, and non-blocking input handling.
This module is part of the ragnetto software suite.
🚀 Features
- ANSI Colors : Full support for 16 foreground and background colors.
- Cursor Control : Move (X, Y), toggle visibility (ON/OFF), and change shapes (Block, Bar, Underline).
- Advanced Input : Read single keys immediately without pressing Enter (Non-blocking input) with or without Echo.
- Cross-platform : Support for Unix-like systems (Linux/macOS) and Windows (via PowerShell integration).
- Terminal Info : Auto-detect console width and height.
📦 Installation
Install the module via PyPI:
pip install ragnetto-console
🛠️ Quick Start
from ragnetto import console
# Clear screen and set window title
console.clear()
console.title("Ragnetto-Console Demo")
# Write colored text at specific coordinates (X, Y)
console.write("Welcome to Ragnetto-Console!", "LIGHT_GREEN", "BLACK", 10, 5)
# Read a key without waiting for Enter
print("\nPress any key to exit...")
console.getkey()
# Reset terminal styles to default
console.reset()
📖 API Reference
| Function | Description |
|---|---|
console.clear() |
Clears the screen and resets the cursor to the home position. |
console.backcolor() |
Set the background text color. |
console.forecolor() |
Set the foreground text color. |
console.cursor(state) |
Toggles cursor visibility. |
console.caret(shape) |
Changes the cursor shape. |
console.position(x, y) |
Moves the cursor to the specified coordinates. |
console.write(text, [f], [b], [x], [y]) |
Writes text with optional colors and coordinates. |
console.getkey() |
Reads a single keypress immediately (No-echo). |
console.putkey() |
Reads a single keypress and prints it (Echo). |
console.title(text) |
Sets the terminal window title. |
console.width() |
Returns the current terminal width. |
console.height() |
Returns the current terminal height. |
console.reset() |
Resets all styles, colors, and cursor states. |
💎 Constants
🎨 Colors
You can use these strings for foreground (f) and background (b) parameters:
- Standard:
BLACK,RED,GREEN,YELLOW,BLUE,MAGENTA,CYAN,WHITE - Bright:
GRAY,LIGHT_RED,LIGHT_GREEN,LIGHT_YELLOW,LIGHT_BLUE,LIGHT_MAGENTA,LIGHT_CYAN,LIGHT_WHITE
🖱️ Caret Shapes
Values for the console.caret(shape) function:
| Constant | Description |
|---|---|
BLOCK_BLINK |
Blinking block cursor |
BLOCK_STEADY |
Static block cursor |
UNDERLINE_BLINK |
Blinking underline cursor |
UNDERLINE_STEADY |
Static underline cursor |
BAR_BLINK |
Blinking vertical bar |
BAR_STEADY |
Static vertical bar |
⚙️ States
Values for console.cursor(state):
1or"ON": Show cursor.0or"OFF": Hide cursor.
📝 License
Distributed under the MIT License. See LICENSE for more information.
Author: ragnetto-gab (Ragnetto®)
E-Mail: ragnettosoftware@gmail.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ragnetto_console-0.1.0.tar.gz.
File metadata
- Download URL: ragnetto_console-0.1.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
beda52edf320496f1f73fe668c83fbb96d321b581bdae89a204a5d342be52f58
|
|
| MD5 |
f8b6f49bfd5538c8aaacdbf9b3a18c64
|
|
| BLAKE2b-256 |
a09065cb1d50b0875cf55be5acc50be14a6f11444044f9f61de7d5d57552ff9f
|
File details
Details for the file ragnetto_console-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ragnetto_console-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af0067ae3dc6309395517c59db0901c4ef17fe0fdb873cb0e0d12f97d71e1f10
|
|
| MD5 |
8895f438f71e03c06543acac8a45726b
|
|
| BLAKE2b-256 |
cc8cf751b7067c8c8c68409865ba2d4b980058eac84959dc3ef3d004db2c0256
|