Could i take a motion sensor that is attached to the raspberry pi (running Raspbian) that when the sensor is tripped that it would send a keyboard stoke.
i am hoping that the keyboard stroke would control a application.
looking for this to be done in python, but other suggestions would be greatly appreciated
Yes you can detect when the motion sensor is triggered and make it send a keyboard stroke using the python-uinput module.
example below in python
import uinput
# set up keystroke input
device = uinput.Device([uinput.KEY_TAB])
while True:
triggered_sensor = get_sensor_method()
if triggered_sensor:
device.emit_click(uinput.KEY_TAB)
This is one suggestion and I have not tested it either. The links below might help you in searching for alternative solutions in python.