简体   繁体   English

如何在布赖顿(Brython)上绘制画布?

[英]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. 我最近正在尝试Brython,但在弄清楚如何在画布上绘制一个简单的矩形时遇到了麻烦,我只能找到非常复杂的绘制画布实例,但对我不起作用,我无法找到一个在文档中明确答案。

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? 有人读过这个书,请告诉我使用Brython用简单的方法在画布上绘制简单形状的方法,或者给我展示一些使我走上正确道路的方法吗?

You have some examples based on a library called brython-bryplot in this IPython/jupyter notebook (it uses a magic function called brythonmagic ). 您有一些基于 IPython / jupyter笔记本中名为brython-bryplot的库的示例(它使用了名为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. 您可以直接使用brython-bryplot库,也可以查看base.py模块来检查形状和文本的实现方式。

If you find any issues just let me know as I'm the developer of brython-bryplot, brythonmagic,... :-D 如果您发现任何问题,请告诉我,因为我是brython-bryplot,brythonmagic,...的开发人员。:-D

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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