AnchorLayout don't work on Android?

44 views
Skip to first unread message

iampirla

unread,
Feb 10, 2018, 3:44:22 AM2/10/18
to Kivy users support
Hi everyone, I'm trying to study Kivy, so I've done a simple gui that work on windows but when I run it on Android with Kivy Launcher I'm getting this error trought ADB LOGCAT :
Traceback (most recent call last):
:    File "main.py", line 19, in <module>
:      PongApp().run()
:    File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/app.py", line 798, in run
:    File "main.py", line 14, in build
:      self.root = Builder.load_file('questionario.kv')
:    File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/lang.py", line 1749, in load_file
:    File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/lang.py", line 1796, in load_string
:    File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/lang.py", line 1185, in __init__
:    File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/lang.py", line 1287, in parse
:    File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/lang.py", line 1384, in parse_level
:    File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/lang.py", line 1384, in parse_level
:    File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/lang.py", line 1394, in parse_level
:  kivy.lang.ParserException: Parser: File "questionario.kv", line 5:
:  ...
:        3:    FloatLayout:
:        4:        AnchorLayout:
:  >>    5:            anchor_y : "top"
:        6:            anchor_x: "right"
:        7:            BoxLayout:
:  ...
:  Invalid property name
: Python for android ended.

As you can see the error is in the .kv file : 

kivy.lang.ParserException: Parser: File "questionario.kv", line 5:
:  ...
:        3:    FloatLayout:
:        4:        AnchorLayout:
:  >>    5:            anchor_y : "top"
:        6:            anchor_x: "right"
:        7:            BoxLayout:


This is my KV file(It's really simple, I've done this in order to exercise) : 
<ROT>:
    FloatLayout:
        AnchorLayout:
            anchor_y : "top"
            anchor_x: "right"
            BoxLayout:
                orientation : "horizontal"
                spacing: 10
                size_hint: 0.4,0.1
                Button:
                    id : "_bfr"
                    text : "<-----"

                Button:
                    on_press : root.press()
                    id : "_aft"
                    text : "----->"
        AnchorLayout :
            anchor_x : "center"
            anchor_y : "top"
            ScreenManager:
                id : _manager
                Screen :
                    name : "uno"
                    BoxLayout :
                        padding : [6,root.height*0.1+20,6,20]
                        spacing :4
                        orientation : "vertical"
                        BoxLayout:
                            orientation:"horizontal"
                            size_hint_y : 0.05
                            Label :
                                size_hint_x: 0.1
                                text : "Nome :"
                            TextInput :
                                size_hint_x: 0.4
                                id : _name
                                multiline: False
                            Label :
                                size_hint_x: 0.1
                                text : "Cognome :"
                            TextInput :
                                size_hint_x: 0.4
                                id : _surname
                                multiline: False

                        BoxLayout:
                            padding: [6,40,6,5]
                            size_hint_y : 0.2
                            CheckBox:
                                group : "c"
                                size_hint_x : 0.25
                                id : _ck1
                            CheckBox:
                                group: "c"
                                size_hint_x : 0.25
                                id : _ck2
                            CheckBox:
                                group: "c"
                                size_hint_x : 0.25
                                id : _ck3
                            CheckBox:
                                group: "c"
                                size_hint_x : 0.25
                                id : _ck4
                        BoxLayout:
                            size_hint_y : 0.3
                            Label :
                                text_size : self.size
                                size_hint_x : 0.25
                                halign:"center"
                                valign: "top"
                                text: "plastica"
                            Label :
                                text_size : self.size
                                size_hint_x : 0.25
                                halign:"center"

                                valign: "top"
                                text : "carta"
                            Label :
                                text_size : self.size
                                size_hint_x : 0.25                          
                                halign:"center"

                                valign: "top"
                                text : "vetro"
                            Label :
                                halign:"center"

                                text_size : self.size
                                size_hint_x : 0.25
                                valign: "top"
                                text : "indifferenziata"


                        Label:

                Screen :
                    name : "due"
                    Label:
                        text : "FFFFFF"


ZenCODE

unread,
Feb 10, 2018, 9:48:19 AM2/10/18
to Kivy users support
Which version of the launcher are you using? And which kivy version on windows? 

iampirla

unread,
Feb 10, 2018, 12:27:55 PM2/10/18
to Kivy users support
The kivy launcher is 1.9
And kivy is 1.10 , but I haven't compiled it.
It's possible that the error occurs because I haven't imported the AnchorLayout in the main.py? But on Windows works well without it

ZenCODE

unread,
Feb 10, 2018, 10:51:50 PM2/10/18
to Kivy users support
I doubt that is the problem as the importing seems to work. It does not error on the import, only on the setting of that property value. What happens if you comment that particular line out?

iampirla

unread,
Feb 11, 2018, 12:15:20 PM2/11/18
to Kivy users support

I've done as you sad but It retur another strange error:

iampirla .

unread,
Feb 11, 2018, 2:33:41 PM2/11/18
to kivy-...@googlegroups.com
---------- Messaggio inoltrato ----------
Da: "iampirla" <iamp...@gmail.com>
Data: 10 feb 2018 9:44 AM
Oggetto: [kivy-users] AnchorLayout don't work on Android?
A: "Kivy users support" <kivy-...@googlegroups.com>
Cc:
--
You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/uxBV3RnriXI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kivy-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ZenCODE

unread,
Feb 12, 2018, 1:30:06 AM2/12/18
to Kivy users support
Please post the full message. We can only see part of it.
To unsubscribe from this group and all its topics, send an email to kivy-users+...@googlegroups.com.

iampirla

unread,
Feb 12, 2018, 2:22:19 AM2/12/18
to Kivy users support
I've done as you said but it returns a similar error with the BoxLayout

ZenCODE

unread,
Feb 12, 2018, 2:58:25 AM2/12/18
to Kivy users support
Please post the full message.

iampirla

unread,
Feb 12, 2018, 3:20:14 AM2/12/18
to Kivy users support
What do you mean? I,be done as you said
( #anchor_y)
But it returns a similar error
Cattura.PNG

Alexander Taylor

unread,
Feb 13, 2018, 4:46:51 PM2/13/18
to Kivy users support
You erroneously have a space in between the property name and the colon. It should read "orientation: 'horizontal'".

Also, when posting errors please paste the actual text, not a screenshot.
Reply all
Reply to author
Forward
0 new messages