diff options
Diffstat (limited to 'python/examples')
-rw-r--r-- | python/examples/example-client.py | 9 | ||||
-rw-r--r-- | python/examples/example-service.py | 16 |
2 files changed, 25 insertions, 0 deletions
diff --git a/python/examples/example-client.py b/python/examples/example-client.py new file mode 100644 index 00000000..24906b83 --- /dev/null +++ b/python/examples/example-client.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python + +import dbus + +bus = dbus.Bus() +remote_service = bus.get_service("org.designfu.SampleService") +remote_object = remote_service.get_object("/MyObject", "org.designfu.SampleInterface") + +remote_object.HelloWorld("Hello from example-client.py!") diff --git a/python/examples/example-service.py b/python/examples/example-service.py new file mode 100644 index 00000000..eb55af44 --- /dev/null +++ b/python/examples/example-service.py @@ -0,0 +1,16 @@ +import dbus + +import pygtk +import gtk + +class MyObject(dbus.Object): + def __init__(self): + service = dbus.Service("org.designfu.SampleService") + dbus.Object("/MyObject", [self.HelloWorld], service) + + def HelloWorld(self, arg1): + print ("Hello World!: %s" % (arg1)) + +object = MyObject() + +gtk.main() |