Catching Thymio events in Python through DBus
Created by: pierreboudes
The code exemple of the Python bindings for D-Bus examples/clients/python-dbus/aseba.py introduced in #290 to resolve #286 (closed) is quite confusing.
How is it supposed to work after entering the infinite loop gobjects.MainLoop()
(loop.run()
is called when __enter__
'ing the with statement) ?
If we postpone the loop.run()
, the code correctly fetch the values ("acc"
and "temperature"
) but trying to capture "timer0"
fails with a no event named timer0
error. With a numerical id instead of an event name, it is executed without throwing any error but the callback is never called.
This is the only piece of documentation on events handling and after tweaking a bit with it I am still unable to capture an event emitted by Thymio. Is it possible to have some hints on how to program a simple example, let say, of a Python code which react to a button.backward
emitted by a Thymio ?
Thanks !