赞
踩
- async def conversion(text, output, role, rate, volume):
- tts = edge_tts.Communicate(text=text, voice=role, rate=rate, volume=volume)
- await tts.save(output)
- def carousel(self, img_index=0):
- if img_index >= len(self.carousels):
- img_index = 0
- self.label2.config(image=self.carousels[img_index])
- self.form.after(self.carousel_time * 1000, self.carousel, img_index + 1)
- class Worker(object):
- thread_pool = None
-
- def __init__(self, task, when_done, *args, synchronous=True):
- self._task = task
- self._args = args
- self.synchronous = synchronous
- self.when_done = when_done
-
- def _my_task(self):
- try:
- if self.synchronous:
- res = self._task()
- else:
- res = asyncio.run(self._task(*self._args))
- except Exception as e:
- res = False, e
- self.when_done(res)
-
- def start(self):
- if not Worker.thread_pool:
- Worker.thread_pool = ThreadPoolExecutor(max_workers=1)
- Worker.thread_pool.submit(self._my_task)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。