Asynchronous Pyglet Render Loop: The Key to Smooth and Responsive Functionality

Опубликовано: 20 Сентябрь 2024
на канале: Python for Everyone
215
22

With threads, tasks are executed parallel. The idea of cooperative multitasking is that tasks are chopped up in little pieces and executed serially. This way the program never has to switch contexts and there is no danger that finished threads change state in unexpected ways. In this video, you will see an experiment to call a blocking function from pyglet and make it behave asynchronously.

C H A P T E R S
0:25 Blocking functions called by frameworks
1:46 Threads or asyncio?
3:55 Call a blocking function
5:05 Make asynchronous game loop
6:25 Schedule function to the event loop

M Y O N L I N E T R A I N I N G
Do you like my style of teaching? Try free chapters of my online courses: