Created
June 10, 2018 09:48
-
-
Save kiok46/cfbbe8b480cee170508f65ba3de51413 to your computer and use it in GitHub Desktop.
Plyer: Platform independent compatibility layer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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