diff options
Diffstat (limited to 'Adding_TTS_gtk3/gst_simple_example.py')
-rwxr-xr-x | Adding_TTS_gtk3/gst_simple_example.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Adding_TTS_gtk3/gst_simple_example.py b/Adding_TTS_gtk3/gst_simple_example.py index 3962777..469c2a7 100755 --- a/Adding_TTS_gtk3/gst_simple_example.py +++ b/Adding_TTS_gtk3/gst_simple_example.py @@ -1,3 +1,4 @@ +#!/usr/bin/python # # <one line to give the program's name and a brief idea of what it does.> # Copyright (C) <YEAR> <NAME> @@ -17,20 +18,24 @@ # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # +import gi +gi.require_version('Gtk', '3.0') from gi.repository import Gtk -import gst +gi.require_version('Gst', '1.0') +from gi.repository import Gst +Gst.init(None) def gstmessage_cb(bus, message, pipe): - if message.type in (gst.MESSAGE_EOS, gst.MESSAGE_ERROR): - pipe.set_state(gst.STATE_NULL) + if message.type in (Gst.MessageType.EOS, Gst.MessageType.ERROR): + pipe.set_state(Gst.State.NULL) pipeline = 'espeak text="Hello, World!" ! autoaudiosink' -pipe = gst.parse_launch(pipeline) +pipe = Gst.parse_launch(pipeline) bus = pipe.get_bus() bus.add_signal_watch() bus.connect('message', gstmessage_cb, pipe) -pipe.set_state(gst.STATE_PLAYING) +pipe.set_state(Gst.State.PLAYING) Gtk.main() |