LadyCoder
LadyCoder

Reputation: 336

How to make horizontal scrollview in kivy

i've been trying to make a horizontal scrollview but it won't work for two or more widget...instead it will automatically convert them( the widget) to a kind of an ASCII characters

main.py

#...neccessary modules imported

class Root( BoxLayout ):
    pass


class MainApp( MDApp ):
    pass

if __name__ == "__main__":
    MainApp().run()

then inside the main.kv file, i got

Root
<Root>:
    orientation:"vertical"

    ScrollView:
       do_scroll_x: True
       do_scroll_y: False 

       BoxLayout:
          size_hint:None, None
          width:self.minimum_width
          spacing:dp(20)

          # Then follows repetition of the below widget 20 times
          MDCard:
            MDLabel:
              text:"some text"

it wont show the widget but some random Ascii characters

Upvotes: 0

Views: 263

Answers (1)

noEmbryo
noEmbryo

Reputation: 2231

You have to give some size to the contents of the BoxLayout:

            # Then follows repetition of the below widget 20 times
            MDCard:
                size_hint:None, None
                size: dp(100), dp(50)
                MDLabel:
                    text:"some text"

Upvotes: 1

Related Questions