A Cowsay clone in Python
Project description
Python Cowsay
A rewrite of cowsay in python. Allows for parsing of existing .cow
files.
Install
pip install python-cowsay
Usage
The classic cowsay can be generated by the cowsay
or cowthink
functions:
from cowsay import cowsay
message = """
The most remarkable thing about my mother is that for thirty years she served
the family nothing but leftovers. The original meal has never been found.
-- Calvin Trillin
"""
print(cowsay(message))
Will yield:
__________________________________________
/ The most remarkable thing about my \
| mother is that for thirty years she |
| served the family nothing but leftovers. |
| The original meal has never been found. |
| |
\ -- Calvin Trillin /
------------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
The arguments for these functions are:
message
– a string to wrap in the text bubblecow='default'
– the name of the cow (valid names fromlist_cows
)preset=None
– the original cowsay presets:-bggpstwy
eyes=Option.eyes
– A custom eye stringtongue=Option.tongue
– A custom tongue stringwidth=40
– The width of the text bubblewrap_text=True
– Whether text should be wrapped in the bubblecowfile=None
– A custom string representing a cow
Other Functions
The available builtin cows can be found with list_cows
. A cow can be chosen
randomly from this list with get_random_cow
.
A custom .cow
file can be parsed using the read_dot_cow
function which takes
a TextIO
stream.
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
python-cowsay-1.0.0.tar.gz
(16.0 kB
view hashes)
Built Distribution
Close
Hashes for python_cowsay-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c931e096acbe6c7ccfc244d6495d45621ee9b8faf0ae1beda8e6b2c85799b601 |
|
MD5 | c91d8ca7364be799f9e90ba29a5326ab |
|
BLAKE2b-256 | 3981289658ac57a1cfbab987fe16d499d678072f0bcaaffd82f148248c4d0ca4 |