CheckBox Error 'NoneType' not subscriptable

90 views
Skip to first unread message

rPhoenix

unread,
Feb 28, 2020, 10:50:55 AM2/28/20
to Kivy users support
Hey Guys,

I'm working on Kali Linux and trying to make a Python Kivy App. I'm new to Kivy and can't seem to figure this out. I have the latest version of Kivy. Any help appreciated.

checkbox_list.py:

    '''
    CheckBoxApp
    ===========
   
    Learning the art of checking those boxes.
    '''

   
   
   
from kivy.app import App
   
from kivy.lang import Builder
   
from kivy.uix.checkbox import CheckBox
   
from kivy.uix.boxlayout import BoxLayout
   
    kv
= '''
    BoxLayout:
        orientation: '
vertical'
        BoxLayout:
            orientation: '
horizontal'
            Label:
                text: '
Alphabit'
            CheckBox:
                size_hint_y: None
                    height: '
48dp'
        BoxLayout:
            orientation: '
horizontal'
            Label:
                text: '
Days of the Week'
            Button:
                text: '
Button 1'
        BoxLayout:
            orientation: '
horizontal'
            Label:
                text: '
Months of the Year'
            Button:
                text: '
Button 1'
        BoxLayout:
            orientation: '
horizontal'
            Label:
                text: '
1 to 25'
            Button:
                text: '
Button 1'
        BoxLayout:
            orientation: '
horizontal'
            Label:
                text: '
26 to 50'
            Button:
                text: '
Button 1'
        BoxLayout:
            orientation: '
horizontal'
            Label:
                text: '
51 to 75'
            Button:
                text: '
Button 1'
        BoxLayout:
            orientation: '
horizontal'
            Label:
                text: '
76 to 100'
            Button:
                text: '
Button 1'
        BoxLayout:
            orientation: '
horizontal'
            Label:
                text: '
101 to 125'
            Button:
                text: '
Button 1'
        BoxLayout:
            orientation: '
horizontal'
            Label:
                text: '
126 to 150'
            Button:
                text: '
Button 1'
        BoxLayout:
            orientation: '
horizontal'
            Label:
                text: '
151 to 175'
            Button:
                text: '
Button 1'
        BoxLayout:
            orientation: '
horizontal'
            Label:
                text: '
176 to 200'
            Button:
                text: '
Button 1'
    '''

   
   


    class NewProjectApp(App):
        def build(self):
            return Builder.load_string(kv)
   
   
    NewProjectApp().run()


Console Error:

    root@kali:~/Documents/Lab/Python/Kivy# python3 checkbox_list.py
    [INFO   ] [Logger      ] Record log in /root/.kivy/logs/kivy_20-02-28_9.txt
    [INFO   ] [Kivy        ] v1.10.1
    [INFO   ] [Python      ] v3.7.6 (default, Jan 19 2020, 22:34:52)
    [GCC 9.2.1 20200117]
    [INFO   ] [Factory     ] 194 symbols loaded
    [INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
     Traceback (most recent call last):
       File "checkbox_list.py", line 92, in <module>
         NewProjectApp().run()
       File "/usr/lib/python3/dist-packages/kivy/app.py", line 800, in run
         root = self.build()
       File "checkbox_list.py", line 89, in build
         return Builder.load_string(kv)
       File "/usr/lib/python3/dist-packages/kivy/lang/builder.py", line 368, in load_string
         parser = Parser(content=string, filename=fn)
       File "/usr/lib/python3/dist-packages/kivy/lang/parser.py", line 392, in __init__
         self.parse(content)
       File "/usr/lib/python3/dist-packages/kivy/lang/parser.py", line 501, in parse
         objects, remaining_lines = self.parse_level(0, lines)
       File "/usr/lib/python3/dist-packages/kivy/lang/parser.py", line 605, in parse_level
         level + 1, lines[i:], spaces)
       File "/usr/lib/python3/dist-packages/kivy/lang/parser.py", line 605, in parse_level
         level + 1, lines[i:], spaces)
       File "/usr/lib/python3/dist-packages/kivy/lang/parser.py", line 664, in parse_level
         if current_property[:3] == 'on_':
     TypeError: 'NoneType' object is not subscriptable


Elliot Garbus

unread,
Feb 28, 2020, 11:35:03 AM2/28/20
to kivy-...@googlegroups.com
The indentation of height under checkbox is wrong. Start there. 

Sent from my iPhone

On Feb 28, 2020, at 8:51 AM, rPhoenix <rlee3d....@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/03dda881-b08e-420b-8401-caf7a51b7b1c%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages