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.1.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.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: persian_print-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 e76841a4563180ad8e4b3d1e6e5a43b97ca30f57a65336ed207807fb10498b3d
MD5 b740d39536b1b641d8f000dee06e8899
BLAKE2b-256 745da2208f0fcd3d5c8cd77c9a391c4fc5f6e8bbe9409183a6edf146b643e459

See more details on using hashes here.

File details

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

File metadata

  • Download URL: persian_print-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2600d793e9fa70fa131fd66e17d3171c9a571f95a8070652fd9bf9dc1c1f1817
MD5 d098b62ca36f09e88ef06987c3981cda
BLAKE2b-256 6c9ca1ba0aaa76e09c0a873364ff22818a0ca2a065890b564b658e5414d1e96f

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