Skip to main content

A Python library for easy Persian printing with advanced features and automatic dependency installation.

Project description

کتابخانه Persian Print

یک کتابخانه پایتون برای چاپ آسان متن فارسی با قابلیت‌های پیشرفته و نصب خودکار وابستگی‌ها.

ویژگی‌ها

  • چاپ صحیح متن فارسی با پشتیبانی از راست به چپ (RTL)
  • رنگی کردن و استایل‌دهی به متن (پررنگ، زیرخط‌دار، رنگ پس‌زمینه)
  • نصب خودکار وابستگی‌ها بر اساس سیستم عامل (مناسب برای VS Code و Termux)
  • API ساده و کاربرپسند برای توسعه‌دهندگان

نصب

برای نصب کتابخانه، می‌توانید از pip استفاده کنید:

pip install persian_print

توجه: این کتابخانه به صورت خودکار وابستگی‌های arabic-reshaper و python-bidi را در صورت نیاز نصب می‌کند.

مثال‌های استفاده

چاپ متن فارسی ساده

برای چاپ متن فارسی، کافیست از تابع print_persian استفاده کنید:

from persian_print import print_persian

print_persian("سلام دنیا! این یک متن فارسی است.")
print_persian("چاپ فارسی آسان شد!")

چاپ متن رنگی و استایل‌دار

تابع colored_print به شما امکان می‌دهد متن را با رنگ‌های مختلف، استایل‌های (مانند پررنگ یا زیرخط‌دار) و حتی رنگ پس‌زمینه چاپ کنید.

رنگ‌ها: black, red, green, yellow, blue, magenta, cyan, white, reset استایل‌ها: normal, bold, underline رنگ‌های پس‌زمینه: black, red, green, yellow, blue, magenta, cyan, white, default

from persian_print import colored_print

# چاپ متن قرمز
colored_print("این یک متن قرمز است.", color="red")

# چاپ متن سبز و پررنگ
colored_print("این یک متن سبز و پررنگ است.", color="green", style="bold")

# چاپ متن آبی با پس‌زمینه زرد و زیرخط‌دار
colored_print("متن آبی با پس‌زمینه زرد و زیرخط‌دار.", color="blue", background="yellow", style="underline")

# ترکیب چند ویژگی
colored_print("ترکیب رنگ، استایل و پس‌زمینه.", color="white", background="magenta", style="bold")

مثال کامل

from persian_print import print_persian, colored_print

print_persian("به کتابخانه Persian Print خوش آمدید!")
print_persian("این کتابخانه به شما کمک می‌کند تا متن فارسی را به راحتی در ترمینال چاپ کنید.")

print("\n--- مثال‌های رنگی کردن متن ---")
colored_print("متن قرمز", color="red")
colored_print("متن سبز و پررنگ", color="green", style="bold")
colored_print("متن آبی با پس‌زمینه زرد", color="blue", background="yellow")
colored_print("متن زیرخط‌دار", style="underline")
colored_print("متن پررنگ و زیرخط‌دار", style="bold", style="underline")
colored_print("متن سفید با پس‌زمینه آبی", color="white", background="blue")

print("\n--- تست راست به چپ (RTL) ---")
print_persian("سلام، چگونه اید؟")
print_persian("این یک جمله فارسی برای تست RTL است.")
colored_print("متن فارسی رنگی", color="cyan")

توسعه و مشارکت

Pydroid3 (Android) Compatibility

To use persian_print in Pydroid3 on Android, ensure you have the necessary libraries installed. You can install them using pip within Pydroid3's terminal:

pip install arabic-reshaper python-bidi

The package has been designed to handle right-to-left (RTL) text display correctly, which should function as expected within the Pydroid3 environment once dependencies are met.

مجوز

این پروژه تحت مجوز 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

persian_print-0.1.2.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

persian_print-0.1.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file persian_print-0.1.2.tar.gz.

File metadata

  • Download URL: persian_print-0.1.2.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc1

File hashes

Hashes for persian_print-0.1.2.tar.gz
Algorithm Hash digest
SHA256 214e291ed9f09d953024bb90f30e9b92cfa41049e082d78db6fa68da1ad0c4ec
MD5 a0318546af28a7c807c52daa613850ef
BLAKE2b-256 356b44f1a820480e7fd80f2064989ab0ef86966d0786e064f5736f3588afa472

See more details on using hashes here.

File details

Details for the file persian_print-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: persian_print-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc1

File hashes

Hashes for persian_print-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6077d30e6fab2cf537ab7e64db26e4626bbe41c2e4fc86c62ea3465457360867
MD5 3465354c5616e4cdd43c1c21dfe44fd6
BLAKE2b-256 2eb3c91bbaf46de4a4f43469a8d84493eeeb9106e949a8557a1b111b14b83691

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