cd ~/local/src git clone https://github.com/kivy/plyer
sudo apt-get install python-stdeb cd ~/local/src/plyer python setup.py --command-packages=stdeb.command bdist_deb cd deb_dist sudo dpkg -i python-plyer_1.2.5dev-1_all.deb
mkdir -p ~/mnt/cel sshfs -p 1234 user@192.168.43.1:/ mnt/cel
cd ~/mnt/cel/storage/emulated/0/kivy mkdir test cd test
import kivy kivy.require('1.0.6') # replace with your current kivy version ! from kivy.app import App from kivy.uix.label import Label class MyApp(App): def build(self): return Label(text='Hello world') if __name__ == '__main__': MyApp().run()
python main.py
title=Test author=test orientation=portrait
mkdir -p ~/mnt/cel/storage/emulated/0/kivy/test/musica/ cp directorio_cancion/cancion.mp3 ~/mnt/cel/storage/emulated/0/kivy/test/musica/
from kivy.app import App from kivy.uix.button import Button from kivy.core.audio import SoundLoader from plyer import accelerometer as acc from kivy.logger import Logger from time import sleep from plyer import gps from kivy.properties import StringProperty from kivy.clock import Clock, mainthread from kivy.lang import Builder kv = ''' BoxLayout: orientation: 'vertical' Label: text: app.gps_location Label: text: app.gps_status BoxLayout: size_hint_y: None height: '48dp' padding: '4dp' ToggleButton: text: 'Start' if self.state == 'normal' else 'Stop' on_state: app.gps.start() if self.state == 'down' else app.gps.stop() ''' class TestApp(App): gps_location = StringProperty() gps_status = StringProperty('Click Start to get GPS location updates') def build(self): self.gps = gps try: self.gps.configure(on_location=self.on_location, on_status=self.on_status) except NotImplementedError: import traceback traceback.print_exc() self.gps_status = 'GPS is not implemented for your platform' return Builder.load_string(kv) @mainthread def on_location(self, **kwargs): self.gps_location = '\n'.join([ '{}={}'.format(k, v) for k, v in kwargs.items()]) @mainthread def on_status(self, stype, status): self.gps_status = 'type={}\n{}'.format(stype, status) if __name__=="__main__": sound = SoundLoader.load('musica/cancion.mp3') if sound: print("Sound found at %s" % sound.source) print("Sound is %.3f seconds" % sound.length) sound.play() acc.enable() x=acc.get_acceleration() sleep(1) x=acc.get_acceleration() x=acc.get_acceleration() x=acc.get_acceleration() x=acc.get_acceleration() x=acc.get_acceleration() Logger.info('title: This is a info message.'+str(x)) TestApp().run()
Cuestionario: