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.4.tar.gz (3.7 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.4-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: persian_print-0.1.4.tar.gz
  • Upload date:
  • Size: 3.7 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.4.tar.gz
Algorithm Hash digest
SHA256 f08afc2319905c1ed0d24994cb1a5220ba5b6cf610a8a844c93dae0a639133d6
MD5 ecf347e42d433700752ee1ae6b55ca21
BLAKE2b-256 eb28fe20734e3eb7e6649330324b4b72ab55ebd741e4bf2d1d0482be71d94883

See more details on using hashes here.

File details

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

File metadata

  • Download URL: persian_print-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 678a970e6319538abcc7f8d234048130c82608c7fed082389e3384ab61af6ee2
MD5 20601682eeea47aedb7d8fa848c0b938
BLAKE2b-256 9c223193b9edcdda323ade3fd17cefcc030c7fcc5a71cc8b02d54d9bea98582a

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