Skip to content

Instantly share code, notes, and snippets.

@kiok46
Created June 10, 2018 09:48
Show Gist options
  • Select an option

  • Save kiok46/cfbbe8b480cee170508f65ba3de51413 to your computer and use it in GitHub Desktop.

Select an option

Save kiok46/cfbbe8b480cee170508f65ba3de51413 to your computer and use it in GitHub Desktop.
Plyer: Platform independent compatibility layer
import kivy
kivy.require('1.8.0')
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.popup import Popup
from plyer import tts
class Text2SpeechDemo(BoxLayout):
def do_read(self):
try:
tts.speak(self.ids.notification_text.text)
except NotImplementedError:
popup = ErrorPopup()
popup.open()
class Text2SpeechDemoApp(App):
def build(self):
return Text2SpeechDemo()
def on_pause(self):
return True
class ErrorPopup(Popup):
pass
if __name__ == '__main__':
Text2SpeechDemoApp().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment