Python Forum
pyjama - frame every x seconds? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: pyjama - frame every x seconds? (/thread-15470.html)



pyjama - frame every x seconds? - MuntyScruntfundle - Jan-18-2019

Hi folks.

I've worked with a couple of game engines before where this would be pretty easy, but I can't find a good example of updating the display every x seconds.

I understand frame rates, do I need another thread updating the background data while the app churns out frames? Or can I update every x seconds?

Thanks.


RE: pyjama - frame every x seconds? - nilamo - Jan-18-2019

I don't know about pyjamas, but since it looks like it's just a python-javascript compatability layer, I'm not sure it would make sense to re-build the dom every x seconds. You could use the Timer class to do background tasks: http://pyjs.org/api/library.pyjamas.Timer.Timer-class.html

The Asteroids example also uses a Canvas class, which has a draw() method that might get called every frame. But I don't actually see the Canvas class in the docs anywhere.


RE: pyjama - frame every x seconds? - MuntyScruntfundle - Jan-18-2019

I don't know much about pyjamas either.

And why am I a "Silly Frenchman"?