I have a thread for all async stuff (eg networking) and run pyglet on the main thread (because windows seems to have problems if you run it in another thread - linux is ok with it though).
for example def run(self): with concurrent.futures.ThreadPoolExecutor() as thread_pool: #submit networking/async stuff to thread_pool try: pyglet.app.run() finally: #tell networking thread to shutdown atexit.unregister(concurrent.futures.thread._python_exit) # helps the program exit cleanly if there are blocking reads in threads that will never complete I don't know if this is the "right way" but it works for me - just keep all the async in one thread and communicate with it in a threadsafe manner On Friday, 2 October 2020 at 5:32:21 am UTC+10 chris....@googlemail.com wrote: > Hi all, > Is there an officially-supported way to use asyncio from within Pyglet? > > If not, what's the recommended way to do networking with Pyglet? > > Thanks in advance. > > Take care, > > Chris Norman > > -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/pyglet-users/7cb132dc-3f3b-4e27-993f-7ad78f24f83an%40googlegroups.com.