0
How do you use canvas with Brython?
I tried to use canvas with Brython but it won't work. I did requestAnimationFrame but it throws an error, I do a while True but it just doesn't run at all. https://code.sololearn.com/Wp3M9Mu0B60L/?ref=app
3 ответов
+ 2
There is no requestAnimationFrame global variable in Brython. An alternative function request_animation_frame from browser.timer is used.
I tried to fix your code with it, but it gives another error about object cloning; I cannot help you with it for now.
And I have found a short introduction to using Canvas2D with Brython, it may help you: https://agentultra.com/blog/JUMP_LINK__&&__python__&&__JUMP_LINK-and-canvas2d-with-brython/ .
+ 1
get I got it to work. If you import "window" and use "window.requestAnimationFrame"it works
As for the link, unfortunately it gets blocked on Firefox for insecure connection :/
+ 1
get dammit another bug. After commenting stuff out, it's caused by window.requestAnimationFrame for some reason