(self, widget)
| 89 | 'callback_function': '_voices_callback'}) |
| 90 | |
| 91 | def on_say(self, widget): |
| 92 | text = self.text_input.get_text() |
| 93 | pitch = self.pitch_slider.get_value() |
| 94 | rate = self.rate_slider.get_value() |
| 95 | print("Saying: {} at rate {} and pitch {}".format(text, rate, pitch)) |
| 96 | self.execute_javascript( |
| 97 | """ |
| 98 | var synth = window.speechSynthesis; |
| 99 | voices = synth.getVoices(); |
| 100 | var utterThis = new SpeechSynthesisUtterance("{}"); |
| 101 | utterThis.pitch = {}; |
| 102 | utterThis.rate = {}; |
| 103 | utterThis.voice = voices[{}]; |
| 104 | synth.speak(utterThis); |
| 105 | """.format(text, pitch, rate, self.selected_voice_id)) |
| 106 | |
| 107 | # starts the web server |
| 108 | start(MyApp, address="0.0.0.0", port=9990) |
nothing calls this directly
no test coverage detected