jupyter-widgets-contrib/ipycanvas

[Help needed]inspired by this project

Closed this issue · 1 comments

Recently one of the founders of this project recommended to me this project. I read some of its source code, and I found something that inspired me.
I noticed that in your package, you used the widget to create canvas. However, in my project, I did not make it.
Here's my code:
%%javascript
require.undef('counter');

define('counter', ["@jupyter-widgets/base"],
function(widgets) {
var CounterView = widgets.DOMWidgetView.extend({
render: function() {
var canvas = this.el, ctx = canvas.getContext("2d");

    }
});

return {
    CounterView : CounterView
};

});

jupyter says that canvas.getContext is not a function in i.render, how to fix it and generate the canvas?

Today I solved this problem. Closing issue.