Coder Social home page Coder Social logo

drawille's People

Contributors

ajalt avatar asciimoo avatar bmintz avatar dnet avatar exrook avatar hoelzro avatar johanje avatar jvlsg avatar jwilk avatar livibetter avatar mkremins avatar sshbio avatar tribela avatar waldyrious avatar whatthejeff avatar xronophobe avatar yamadapc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

drawille's Issues

Move turtle forward without brushing

I would like to call .forward() or .fd() without enabling the brush.
I'm using .up() and .down() to control the brush but forward implicitly enables the brush and I would like to know why this is intended behaviour.

The fix for me would be removing these lines from drawille.py.

prev_brush_state = self.brush_on
self.brush_on = True
self.brush_on = prev_brush_state

I'm currently having a blast using drawille!

⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⢇⡀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠤⠒⠉⠀⠀⠈⠑⠢⢄
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠤⠊⢹⠉⠒⠤⣀⢀⡠⠔⠊⢹⠉⠢⢄⡀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⢸⠀⠀⠀⠀⡇⠀⠀⠀⢸⠀⠀⠀⢸
⠀⠀⠀⣀⠤⠢⢄⡀⠀⢸⠀⠀⡠⠜⠀⠀⠀⠀⡇⠀⠀⠀⠘⠤⡀⠀⢸⠀⠀⣀⠤⠢⢄⡀
⠠⣒⠉⠀⠀⠀⠀⠈⢑⣺⣒⠉⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠈⢑⣺⣒⠉⠀⠀⠀⠀⠈⢑⡢
⠀⠀⠉⠒⠤⡠⠔⠊⠁⢸⠀⠉⠢⢄⠀⠀⠀⠀⡇⠀⠀⠀⢀⠤⠊⠁⢸⠀⠉⠒⠤⡠⠔⠊⠁
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⢸⠀⠀⠀⠀⡇⠀⠀⠀⢸⠀⠀⠀⢸
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠒⠤⡀⢸⠀⣀⠤⠒⠑⠢⢄⡀⢸⠀⡠⠔⠊
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠭⣀⠀⠀⠀⠀⢀⡨⠝⠉
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠒⡔⠊⠁
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁

Why does drawille does not draw in full terminal ?

My terminal size is 202*62 but drawille is drawing a line in half of the terminal, why so ?

>>> import drawille
>>> drawille.getTerminalSize()
(202, 62)
>>> c = drawille.Canvas()
>>> for i in range(0,202):
... 	c.set(i,0)
... 
>>> print c.frame(0,0,202,62)

screen shot 2017-07-16 at 3 19 19 pm

install / run in a Windows environment

I'd like to use drawille on a Windows operating system (Windows 7 or 10). After successfully installing the drawille package into my virtual environment, using pip, using it by typing

>>> from drawille import Canvas

leads to this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\nnako\ENV__Python27\lib\site-packages\drawille.py", line 23, in <module>
    import curses
  File "C:\PROGS\Python__v2_7_9\Lib\curses\__init__.py", line 15, in <module>
    from _curses import *
ImportError: No module named _curses

So, it seems, there is a dependency on the curses package and Windows doesn't provide the package, natively. So I installed curses using the instructions from this StackOverflow post. But when I now enter my python installation and enter the following lines:

>>> from drawille import Canvas
>>> c=Canvas()
>>> c.set(10,10)
>>> print(c.frame())

the result on screen is:

Ôáä

and not a dot as expected (and as I see when using my Linux computer and the same lines of code).

Any hints?

rotating_cube.py example fails on Terminal.app at 80x24

I'm running OS X, El Capitan, Terminal.app.

Traceback (most recent call last):
  File "term_display.py", line 108, in <module>
    curses.wrapper(__main__, projection)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/curses/wrapper.py", line 43, in wrapper
    return func(stdscr, *args, **kwds)
  File "rotating_cube.py", line 94, in __main__
    stdscr.addstr(0, 0, '{0}\n'.format(f))
_curses.error: addstr() returned ERR

I changed line 93 to:
f = c.frame(-40, -40, 40, 40)

And it worked.

More relaxed licensing?

I was wondering whether or not the choice of AGPL was intentional, given it restricts the use in many projects that can't change their license to use it. Will it be possible to consider switching to a more permissive license?

I also see that node-drawille, which is a pretty direct translation is licensed under MIT...

AttributeError: tobytes

I have Python 2.7.5 on Mac OSX Mavericks with PIL 1.1.7 and I get the following when running the xkcd.py example:

Traceback (most recent call last):
  File "xkcd.py", line 66, in <module>
    for pix in i.tobytes():
  File "/Library/Python/2.7/site-packages/PIL/Image.py", line 512, in __getattr__
    raise AttributeError(name)
AttributeError: tobytes

I was able to fix it by changing line 66 from:

for pix in i.tobytes():

to

for pix in i.tostring():

I found it with some help from this stackoverflow question. It seems like the official PIL 1.1.7 still uses the tostring method while Pillow is deprecating it in favor of tobytes (although it still supports the old one).

A simple approach to deal with this could be to just test the attribute first:

   try:
        i_converted = i.tobytes()
    except AttributeError:
        i_converted = i.tostring()

    for pix in i_converted:
    (...)

Licence change?

I see that this issue has been raised 7 years ago but I thought I'd see whether anything has changed since then. In particular, python now has the two libraries Rich and Textual that have improved (or soon will improve) python CLI and TUI applications. Being able to have some graphics drawing functionality would be a great addition but both libraries are licenced under the MIT licence, so using drawille would require all applications using it to be released under the AGPL.

Is there any appetite for changing the licence to something more permissive (not necessarily MIT but maybe LGPL?)

Just as a point of interest, it seems like it's a 50/50 split between MIT or AGPL for the other implementations/similar projects mentioned in the README.

color support?

Is there a way to add color support? Alternatively, is there another similar terminal canvas drawing library that you know of that has color support?

Thanks

Problem with the import of Canvas

I have Python 2.7.6 on Ubuntu 14.04 64b. I typed sudo pip install drawille to get drawille.

When I tried to run the example put in the README on GitHub, I got the following message:

Traceback (most recent call last):
    File "drawille.py", line 2, in <module>
        from drawille import Canvas
    File "/home/guillaume/Documents/drawille.py", line 2, in <module>
        from drawille import Canvas
ImportError: cannot import name Canvas

Beginnings of a port to Go

Hi,

Started porting drawille to Go, but I ran into some issues. It may be related to the rounding of numbers, not entirely sure yet.

https://github.com/xyproto/drawillego

The rotating cube example works, but it looks slightly wonky.

I write this in case you wanted to list the port together with the other ports and also for help if you should happen to spot the bug in the Go port.

Best regards,
Alexander Rødseth

ImportError: cannot import name Canvas - Python 3.8 on MacOS BigSur

After successfully installing using the pip command using python3.7, I try running any of the examples.
However, I get a Canvas not found error immediately.

$python drawille.py
Traceback (most recent call last):
  File "drawille.py", line 5, in <module>
    from drawille import Canvas
  File "/Users/*********/repos/drawille/drawille.py", line 5, in <module>
    from drawille import Canvas
ImportError: cannot import name Canvas
$python3 drawille.py
Traceback (most recent call last):
  File "drawille.py", line 5, in <module>
    from drawille import Canvas
  File "/Users/*********/repos/thermal_testing/drawille.py", line 5, in <module>
    from drawille import Canvas
ImportError: cannot import name 'Canvas' from partially initialized module 'drawille' (most likely due to a circular import) (/Users/*********/repos/thermal_testing/drawille.py)

Error when canvas is blank

I got this when running image2term.py from examples.

Traceback (most recent call last):
  File "image2term.py", line 107, in <module>
    __main__()
  File "image2term.py", line 102, in __main__
    args['output'].write(image2term(args['image'], args['threshold'], args['ratio']))
  File "image2term.py", line 66, in image2term
    return can.frame()
  File "/tmp/drawille/examples/drawille.py", line 403, in frame
    return self.line_ending.join(self.rows())
  File "/tmp/drawille/examples/drawille.py", line 354, in rows
    minrow = min(self.pixels.keys())
ValueError: min() arg is an empty sequence

I tried to inspect and conclude that it was because the (default) threshold causes the image become blank. I also tried to do a simple run by creating a Canvas() and call frame(). The result was the same, so that I conclude that a blank canvas leads to an error.

Compatible fonts?

Hey,
So, I tried installing a bunch of fonts (including the ones you listed, such as Terminus), but I still have problems rendering the braille characters.

Can you link a font that will work for sure?
Or provide a way to patch in braille support in an existing font. There is https://aur.archlinux.org/packages/ttf-ubraille/ and I wonder if it can patched in with NerdFonts or something like this. I tried doing it myself, but without success.

A more concise explanation on how the fonts on the system must be configured to use this would be appreciated!

colored output?

Would it be possible to set colors (e.g. RGB tuple) to the outputs?

Couldn't find a working console font.

After scouring the net, I wasn't able to find a .psf font for the Linux console that had support for Unicode, so I made one myself. It's derived from GNU Unifont and hand edited to resemble IBM Plex Mono, including lovingly crafted Braille characters.

It's only available in a 16x8 size, and only covers CP437, so may not be suitable for non English speakers, and the style may not be to everyone's liking, but it's the only way I found to get Braille characters on a vtty.

https://drive.google.com/file/d/1yoyhUHm2wCZfJSgAaW862asiMQfm3ckt/

thanks !

i just wanted to say thanks, this is awesome !
maybe you enjoy some fractals:

⡿⠷⢄
⣿⣦⣸⣷⣄
⣷⣄⢸⣦⡀⣷⣄
⣯⡉⢹⣍⠉⣯⡉⢱⣄
⣟⠛⢺⡛⠓⣟⠛⢺⡛⠓⣄
⠿⠷⠼⠿⠦⠿⠷⠼⠿⠦⠿⠷⠄
⣖⣶⣲⣖⣶⣲⣖⣶⣲⣖⣶⣲⣖⡆
⣯⣇⣀⣯⣿⣽⣀⣸⣽⣯⣇⣀⣯⡇
⡷⣿⢾⡷⡟⠚⠓⠛⠚⡷⣿⢾⡷⡇
⣟⡏⠉⣟⡇⠀⠀⠀⠀⣟⡏⠉⣟⡇
⣯⣿⣽⣯⣇⣀⣀⣀⣀⣯⣿⣽⣯⡇
⡷⡟⠚⡷⣿⢾⠓⢻⢾⡷⡟⠚⡷⡇
⣟⣷⣲⣟⣿⣻⣖⣾⣻⣟⣷⣲⣟⡇
⠀⠀⠀⠀⠀⠀⣠⡀
⠀⠀⠀⠀⠠⠦⠴⠤⠦
⠀⠀⡀⠀⠀⠀⢀⠀⠀⠀⠀⡀
⣠⣈⣍⣠⣀⣄⣩⣁⣄⣠⣈⣍⣠⡀
⡢⡂⠀⡢⡂⠀⠀⠀⠀⡢⡂⠀⡢⡂
⡀⡨⠪⡀⡀⠀⠀⠀⠀⡀⡨⠪⡀⡀
⠊⠂⠀⠊⠢⡠⠀⠠⡠⠊⠂⠀⠊⠂
⠀⠀⠀⠀⠈⠈⡢⡊⠈
⡀⡀⠀⡀⡨⠪⠀⠨⠪⡀⡀⠀⡀⡀
⠊⠢⡠⠊⠂⠀⠀⠀⠀⠊⠢⡠⠊⠂
⡢⡊⠈⡢⡂⠀⠀⠀⠀⡢⡊⠈⡢⡂
⡢⡢⠀⠀⡢⡢⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡢⡢⠀⠀⡢⡢
⠈⠈⡢⡢⠈⠈⡢⡢⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⡢⡢⠈⠈⡢⡢
⡢⡢⠈⠈⡢⡢⠈⠈⠀⠀⠀⠀⠀⠀⠀⠀⡢⡢⠈⠈⡢⡢⠈⠈
⠈⠈⡢⡢⠈⠈⡢⡢⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⡢⡢⠈⠈⡢⡢
⠀⠀⠈⠈⠀⠀⠈⠈⡢⡢⠀⠀⡢⡢⠀⠀⠀⠀⠈⠈⠀⠀⠈⠈⡢⡢⠀⠀⡢⡢
⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⡢⡢⠈⠈⡢⡢⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⡢⡢⠈⠈⡢⡢
⠀⠀⠀⠀⠀⠀⠀⠀⡢⡢⠈⠈⡢⡢⠈⠈⠀⠀⠀⠀⠀⠀⠀⠀⡢⡢⠈⠈⡢⡢⠈⠈
⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⡢⡢⠈⠈⡢⡢⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⡢⡢⠈⠈⡢⡢
⡢⡢⠀⠀⡢⡢⠀⠀⠀⠀⠈⠈⠀⠀⠈⠈⡢⡢⠀⠀⡢⡢⠀⠀⠀⠀⠈⠈⠀⠀⠈⠈
⠈⠈⡢⡢⠈⠈⡢⡢⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⡢⡢⠈⠈⡢⡢
⡢⡢⠈⠈⡢⡢⠈⠈⠀⠀⠀⠀⠀⠀⠀⠀⡢⡢⠈⠈⡢⡢⠈⠈
⠈⠈⡢⡢⠈⠈⡢⡢⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⡢⡢⠈⠈⡢⡢
⠀⠀⠈⠈⠀⠀⠈⠈⡢⡢⠀⠀⡢⡢⠀⠀⠀⠀⠈⠈⠀⠀⠈⠈⡢⡢⠀⠀⡢⡢
⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⡢⡢⠈⠈⡢⡢⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⡢⡢⠈⠈⡢⡢
⠀⠀⠀⠀⠀⠀⠀⠀⡢⡢⠈⠈⡢⡢⠈⠈⠀⠀⠀⠀⠀⠀⠀⠀⡢⡢⠈⠈⡢⡢⠈⠈
⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⡢⡢⠈⠈⡢⡢⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⡢⡢⠈⠈⡢⡢
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⠀⠀⠈⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⠀⠀⠈⠈
⢦⠆⠀⢦⠆⠀⠀⠀⠀⢦⠆⠀⢦⠆
⠳⢛⢞⠳⠃⠀⠀⠀⠀⠳⢛⢞⠳⠃
⣄⡌⠋⣄⣤⣠⠀⢠⣠⣄⡌⠋⣄⡄
⢮⠶⡴⢮⠶⡵⢦⠶⡵⢮⠶⡴⢮⠆
⠀⠘⠞⠀⢀⢀⠳⢃⢀⠀⠘⠞
⠀⠀⠀⠀⢨⣫⣄⣬⣫
⠀⠀⠀⠀⠀⠁⢮⠆⠁

Is there support for PIL

Sorry if I missed anything but Im just wondering how I could integrate PIL images with this?
this lib seems pretty cool so

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.