python - I turn the application on android and this application crashes. Why?(Kivy) -
did write correctly? after application turned on, android device must vibrate, after application turns on, crashes. why apps on kivy crashed? code:
from plyer import vibrator kivy.app import app kivy.properties import stringproperty kivy.clock import clock, mainthread kivy.uix.floatlayout import floatlayout #the ui layout kivy.uix.label import label #a label show information class ui(floatlayout): """docstring ui""" def __init__(self): super(ui, self).__init__() self.lblacce = label(text="vibrate: ") #create label @ center self.add_widget(self.lblacce) #add label @ screen time = 2 try: vibrator.vibrate(time=time) #if want disable it, run: accelerometer.disable() clock.schedule_interval(self.update, 1.0/24) #24 calls per second except: self.lblacce.text = "failed start vibrate" #error class vibrate(app): #our app def build(self): ui = ui()# create ui return ui #show if __name__ == '__main__': vibrate().run() #start our app
Comments
Post a Comment