简体   繁体   中英

How to draw to a canvas in brython?

I was recently trying out Brython and I'm having trouble figuring out how to draw a simple rectangle to a canvas.I can only find very complex examples of drawing to a canvas that don't work for me and I was unable to find a clear answer in the docs.

Could someone reading this please show me a bare-bones way of drawing a simple shape to a canvas with Brython and or show me something to get me on the right track?

You have some examples based on a library called brython-bryplot in this IPython/jupyter notebook (it uses a magic function called brythonmagic ).

You could use directly the brython-bryplot library or you can have a look at the base.py module to check how shapes and text are implemented.

If you find any issues just let me know as I'm the developer of brython-bryplot, brythonmagic,... :-D

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM