lincolnloop / python-qrcode

Python QR Code image generator
https://pypi.python.org/pypi/qrcode
Other
4.43k stars 676 forks source link

Add (no ascii) unicode art generator #141

Closed ilfirin-ms closed 1 year ago

ilfirin-ms commented 7 years ago

Possibility to output text string, which could be included in text documents or spreadsheets. Border handling removed, it is on document design to make sufficient border.

bbjubjub2494 commented 6 years ago

This duplicates the functionality of print_ascii minus the padding.

>>> qr = QRCode()
>>> qr.print_ascii()

    █▀▀▀▀▀█  ▀▀▄█ █▀▀▀▀▀█    
    █ ███ █ █▀▀ ▀ █ ███ █    
    █ ▀▀▀ █ ██▄▄▀ █ ▀▀▀ █    
    ▀▀▀▀▀▀▀ █▄▀ ▀ ▀▀▀▀▀▀▀    
    ▀ ▀█▀█▀▄ ▀██▄▄█▀▀█▀▄     
    ▄▄▄   ▀██▀▄▄█▄█▀ ▄ ▄     
    ▀ ▀ ▀▀▀ █▄█ █  █  █      
    █▀▀▀▀▀█ ▄██▀ ▀ ▄█▀█▀█    
    █ ███ █ █▀██▄█▄ ▀█▀▀▀    
    █ ▀▀▀ █ ▀  ▄█▄█▀ ▄       
    ▀▀▀▀▀▀▀ ▀   ▀  ▀  ▀      

>>> print(qr.make_unicode())
█▀▀▀▀▀█  ▀▀▄█ █▀▀▀▀▀█
█ ███ █ █▀▀ ▀ █ ███ █
█ ▀▀▀ █ ██▄▄▀ █ ▀▀▀ █
▀▀▀▀▀▀▀ █▄▀ ▀ ▀▀▀▀▀▀▀
▀ ▀█▀█▀▄ ▀██▄▄█▀▀█▀▄
▄▄▄   ▀██▀▄▄█▄█▀ ▄ ▄
▀ ▀ ▀▀▀ █▄█ █  █  █
█▀▀▀▀▀█ ▄██▀ ▀ ▄█▀█▀█
█ ███ █ █▀██▄█▄ ▀█▀▀▀
█ ▀▀▀ █ ▀  ▄█▄█▀ ▄
▀▀▀▀▀▀▀ ▀   ▀  ▀  ▀

Code duplication should be avoided. Other than that, having this function could be nice IMHO, but I'm not the maintainer.