Tuxdroid is a robot version of the linux mascot, available from www.kysoh.com. Developer pages here: www.tuxisalive.com/
Here's a tuxdroid service that lets other application speak with the mighty voice of Tux:
#!/usr/bin/python
# Borrowed from http://webcvs.freedesktop.org/dbus/dbus/python/examples/example-service.py
import dbus
import dbus.service
import dbus.glib
import gobject
import sys
sys.path.append('/opt/tuxdroid/api/python')
from tux import *
class TuxObject(dbus.service.Object):
def __init__(self, bus_name, object_path="/Tux"):
dbus.service.Object.__init__(self, bus_name, object_path)
@dbus.service.method("org.dfwpython.TuxInterface")
def Speak(self, hello_message, voice='Male'):
print (str(hello_message))
if voice == 'Male':
speaker = SPK_US_MALE
else:
speaker = SPK_US_FEMALE
pitch=100
tux.tts.select_voice(speaker,pitch)
tux.cmd.mouth_open()
tux.tts.speak( str(hello_message))
tux.cmd.mouth_close()
session_bus = dbus.SessionBus()
name = dbus.service.BusName("org.dfwpython.TuxService", bus=session_bus)
object = TuxObject(name)
mainloop = gobject.MainLoop()
mainloop.run()
No comments:
Post a Comment