how to implement kivy ScrollView with checkboxes?

Solution for how to implement kivy ScrollView with checkboxes?
is Given Below:

I’m completely new to programming, so sorry for my noob questions. Please tell me how can I implement ScrollView in my application? I don’t understand if I need to implement runTouchApp in this case? If so, where it must be placed?

I looked at other scrollview questions but didn’t find an answer that worked for me. I would be grateful for any hint on how to implement scrolling inside.

Thank you in advance.

'''

ScrollView:
    do_scroll_x: False
    do_scroll_y: True

    Label:
        size_hint_y: None
        height: self.texture_size[1]
        text_size: self.width
        padding: 10, 10
        text:
            'really some amazing textn' * 100
'''


from kivy.app import runTouchApp
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.gridlayout import GridLayout
from kivy.core.window import Window
from kivy.uix.label import Label
from kivy.uix.checkbox import CheckBox
from kivy.properties import StringProperty
from kivy.uix.scrollview import ScrollView

Window.size = (240, 480)
Window.clearcolor = (180 / 255, 90 / 255, 3 / 255, 1)
Window.title = "Test"

count = None


class MenuScreen(Screen):
    def __init__(self, **kw):
        super(MenuScreen, self).__init__(**kw)
        box = BoxLayout(orientation='vertical')
        box.add_widget(Button(text="item list", background_color=(0, 1, 1, 1), on_press=lambda x:
        sm.switch_to(Setup(name="setup"))))
        self.add_widget(box)


class Setup(Screen):
    def __init__(self, **kw):
        super(Setup, self).__init__(**kw)

        my_list = ['red', 'green', 'yellow', 'blue', 'white', 'magenta', 'violet']

        self.scroll_list(my_list)

    def scroll_list(self, x):

        grid = GridLayout(cols=1, padding=10, spacing=3)

        label_question = Label(text=f'selectnfrom list:', size_hint=(1, None), halign="left", valign="middle")
        label_question.bind(size=label_question.setter('text_size'))
        grid.add_widget(label_question)

        grid_scroll = GridLayout(cols=2)


        for i in x:
            lbl = Label(text=f'{i}', size_hint=(1, None), halign="left", valign='middle')
            lbl.bind(size=lbl.setter('text_size'))

            grid_scroll.add_widget(lbl)
            radio_btn = CustomCheckBox(text=str(i), size_hint=(0.2, None), group=1)

            grid_scroll.add_widget(radio_btn)
        grid_scroll.bind(minimum_height=grid_scroll.setter('height'))
        root = ScrollView(size_hint=(1, 0.7))

        root.add_widget(grid_scroll)

        grid.add_widget(root)

        grid.add_widget(
            Button(text="submit", background_color=(0, 1, 1, 1), pos_hint=(None, 1), size_hint_y=None,
                   height=60,
                   on_press=lambda x: sm.switch_to(MenuScreen(name="menu"))))

        self.add_widget(grid)



class CustomCheckBox(CheckBox):
    text = StringProperty('')

    def on_active(self, instance, value):
        global count
        if value:
            count = instance.text
            print(f'tThe checkbox text={instance.text} is active')


sm = ScreenManager()
sm.add_widget(MenuScreen(name="menu"))


class Test(App):
    def __init__(self, **kvargs):
        super(Test, self).__init__(**kvargs)

    def build(self):
        return sm


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

I think all you need to do is modify the line:

grid_scroll = GridLayout(cols=2)

to:

grid_scroll = GridLayout(cols=2, size_hint_y=None)

The child of a ScrollView must have at least one of the size_hints set to None.

how to implement kivy ScrollView with checkboxes?

Solution for how to implement kivy ScrollView with checkboxes?
is Given Below:

I’m completely new to programming, so sorry for my noob questions. Please tell me how can I implement ScrollView in my application? I don’t understand if I need to implement runTouchApp in this case? If so, where it must be placed?

I looked at other scrollview questions but didn’t find an answer that worked for me. I would be grateful for any hint on how to implement scrolling inside.

Thank you in advance.

'''

ScrollView:
    do_scroll_x: False
    do_scroll_y: True

    Label:
        size_hint_y: None
        height: self.texture_size[1]
        text_size: self.width
        padding: 10, 10
        text:
            'really some amazing textn' * 100
'''


from kivy.app import runTouchApp
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.gridlayout import GridLayout
from kivy.core.window import Window
from kivy.uix.label import Label
from kivy.uix.checkbox import CheckBox
from kivy.properties import StringProperty
from kivy.uix.scrollview import ScrollView

Window.size = (240, 480)
Window.clearcolor = (180 / 255, 90 / 255, 3 / 255, 1)
Window.title = "Test"

count = None


class MenuScreen(Screen):
    def __init__(self, **kw):
        super(MenuScreen, self).__init__(**kw)
        box = BoxLayout(orientation='vertical')
        box.add_widget(Button(text="item list", background_color=(0, 1, 1, 1), on_press=lambda x:
        sm.switch_to(Setup(name="setup"))))
        self.add_widget(box)


class Setup(Screen):
    def __init__(self, **kw):
        super(Setup, self).__init__(**kw)

        my_list = ['red', 'green', 'yellow', 'blue', 'white', 'magenta', 'violet']

        self.scroll_list(my_list)

    def scroll_list(self, x):

        grid = GridLayout(cols=1, padding=10, spacing=3)

        label_question = Label(text=f'selectnfrom list:', size_hint=(1, None), halign="left", valign="middle")
        label_question.bind(size=label_question.setter('text_size'))
        grid.add_widget(label_question)

        grid_scroll = GridLayout(cols=2)


        for i in x:
            lbl = Label(text=f'{i}', size_hint=(1, None), halign="left", valign='middle')
            lbl.bind(size=lbl.setter('text_size'))

            grid_scroll.add_widget(lbl)
            radio_btn = CustomCheckBox(text=str(i), size_hint=(0.2, None), group=1)

            grid_scroll.add_widget(radio_btn)
        grid_scroll.bind(minimum_height=grid_scroll.setter('height'))
        root = ScrollView(size_hint=(1, 0.7))

        root.add_widget(grid_scroll)

        grid.add_widget(root)

        grid.add_widget(
            Button(text="submit", background_color=(0, 1, 1, 1), pos_hint=(None, 1), size_hint_y=None,
                   height=60,
                   on_press=lambda x: sm.switch_to(MenuScreen(name="menu"))))

        self.add_widget(grid)



class CustomCheckBox(CheckBox):
    text = StringProperty('')

    def on_active(self, instance, value):
        global count
        if value:
            count = instance.text
            print(f'tThe checkbox text={instance.text} is active')


sm = ScreenManager()
sm.add_widget(MenuScreen(name="menu"))


class Test(App):
    def __init__(self, **kvargs):
        super(Test, self).__init__(**kvargs)

    def build(self):
        return sm


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

I think all you need to do is modify the line:

grid_scroll = GridLayout(cols=2)

to:

grid_scroll = GridLayout(cols=2, size_hint_y=None)

The child of a ScrollView must have at least one of the size_hints set to None.