Manohar
Manohar

Reputation: 156

Scrollable text field in kivymd

I am trying to create a text field where I can display codes and snippets without wrapping text instead I want the text to scroll text along both x and y axis. I am trying to use following code but can't do that

ScrollView:
    CodeInput:
        text:"abc"*30
        scroll_x: True

Upvotes: 2

Views: 965

Answers (1)

Ne1zvestnyj
Ne1zvestnyj

Reputation: 1397

from kivy.lang import Builder
from kivymd.app import MDApp


KV = '''
Screen:
    ScrollView:
        id: scroll
        CodeInput:
            size_hint: 1, None
            text: "abc"*3000
            height: max(self.minimum_height, scroll.height)
'''


class MainApp(MDApp):
    def build(self):
        return Builder.load_string(KV)


MainApp().run()

Upvotes: 2

Related Questions