Launch Kivy on Android

So, I can run kivy example files (like pong) on ​​my Android, but I can't run my own application , it just says "Hello world!".

I don't understand if someone can help me.

This is my Python code:

import kivy
from kivy.app import App
from kivy.config import Config
from kivy.uix.label import Label
from kivy.uix.widget import Widget

Config.set('graphics','width','360')
Config.set('graphics','height','640')

class Mot(Widget):
    def mot(self):
        test = 0

    def bouger(self):



class WorDown(App):
    def build(self):
        return Mot()

if __name__ == '__main__':
    WorDown().run()

      

Next is my Kivy code:

#:kivy 1.0

<Mot>:
    Widget:
        canvas:
            Color:
                rgb: (255, 0, 0)
            Rectangle:
                size: (360,640)
                pos: self.pos

    Label:
        text: 'WorDown'
        center_x: root.width / 2

      

And my android.txt:

title=WorDown
author=pito
orientation=portrait

      

So, I put these three files in a folder in the Kivy folder of my Android phone. And when I launch Kivy launcher and click "WorDown", Kivy Launcher launches the app, but it crashes just 3 seconds after ...

And I don't understand why, because it works really well on my Windows computer!

+3


source to share


1 answer


Please take a look at the python code you have included. In class Mot

you have

def bouger(self):

      

but nothing in the body of the function.



Do you really have nothing in your body? Then your code shouldn't run on your computer, so I guess you just haven't posted anything.

If you are sure that the code in this function does not crash, just write "pass" in the body of the function so that it will not confuse other readers.

+2


source







All Articles