Skip to main content

Display playing cards in ASCII format.

Project description

Ascii Cards

A Python script that generates ASCII art playing cards. Can print out multiple cards in one line, allowing for more flexibility with text based card games. Suits and ranks are adjustable.

Returns a string of playing cards when given a 2D list containing a card's rank and suit.

Features

  • Displays an ASCII art version of playing cards.
  • Supports any single or double character value for rank.
  • Supports any single character value for Suits.

Requirements

Python 3.x.

Install

pip install py-ascii-cards

How to use

To display cards.

import ascii_cards

display_cards([["A", "♣"]])

┌─────┐
│A    │
│  ♣  │
│    A│
└─────┘

display_cards([["A", "♠"], ["10", "♥"]])

┌─────┐ ┌─────┐
│A    │ │10   │
│  ♠  │ │  ♥  │
│    A│ │   10│
└─────┘ └─────┘

Can also display a single blank card.

display_blank_card()

┌─────┐
│░░░░░│
│░░░░░│
│░░░░░│
└─────┘

Can also display a blank card in the display_cards function if passed a rank of the value "hidden".

display_cards([["2", "♠"], ["hidden", "hidden"], ["8", '♥']])

┌─────┐ ┌─────┐ ┌─────┐
│2    │ │░░░░░│ │8    │
│  ♠  │ │░░░░░│ │  ♥  │
│    2│ │░░░░░│ │    8│
└─────┘ └─────┘ └─────┘

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

py_ascii_cards-0.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

py_ascii_cards-0.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file py_ascii_cards-0.1.tar.gz.

File metadata

  • Download URL: py_ascii_cards-0.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for py_ascii_cards-0.1.tar.gz
Algorithm Hash digest
SHA256 17df7895989a7d957078879d92d0a37c58aa063f0b41f3913a173ee795efd1d6
MD5 7c8e625d6eb631cf7dc7474a63991f26
BLAKE2b-256 0c53b60564ba1f8c3fe15742f9fd4970e70a48a3b3bc08aace55b4f51b8b98bf

See more details on using hashes here.

File details

Details for the file py_ascii_cards-0.1-py3-none-any.whl.

File metadata

  • Download URL: py_ascii_cards-0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for py_ascii_cards-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d1de0cb1408c3335f5cf155715a36246640aba3855bd48a99f4dfce34ad7be03
MD5 9c7922114e80903587e3e148d55bb648
BLAKE2b-256 f2845fc1113fcdcc52879ade01e2f3b427e59c0cccd7304947fbeb960bb95784

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