I'm trying to enable/disable Textinput in kivy. multiple TextInput are there. (1) when I will click on a TextInput, that particular TextInput will be editable. (2) By default everything will be set on disable mode. (3) scrollbar should be there, as suppose there are some hundreds of inputs are there.(I was unable to bring that). (4) one more problem I am facing is: the text of TextInput is not properly visible when there are hundreds of inputs. so is there any option to set a default size so that it will not affect whether there is only 2-3 inputs or 100s of inputs. (5) the values at TextInput and label should be dynamic, should be stored at variable globally. @PalimPalim already helped me for the existing code. Thank you everyone.
from kivy.app import App
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import StringProperty
from kivy.uix.textinput import TextInput
from kivy.lang import Builder
kivy.uix.scrollview import ScrollView
from kivy.properties import StringProperty
ROWS = ['ac', 'asd', 'kjhgf', 'b' ,'bn', 'sdf', 'ytrwd', 'hfs' ,'erf', ...]
Builder.load_string("""
<Test>:
do_default_tab: False
TabbedPanelItem:
text: 'page1'
scrollView:
size_hint: (None, None)
size: (400, 400)
Table:
padding: 50, 50, 50, 50
orientation: 'vertical'
<Row>:
spacing: 50
size_hint: 1, .9
txt: txtinpt.text
Label:
text: root.txt
TextInput:
id: txtinpt
text: root.txt
Button:
text: 'save'
""")
class Table(BoxLayout):
def __init__(self, **kwargs):
super(Table, self).__init__(**kwargs)
for row in ROWS:
self.add_widget(Row(row))
class Row(BoxLayout):
txt = StringProperty()
def __init__(self, row, **kwargs):
super(Row, self).__init__(**kwargs)
self.txt = row
class ScrollableLabel(ScrollView):
text = StringProperty('')
class Test(TabbedPanel):
pass
class MyApp(App):
def build(self):
test = Test()
return test
if __name__ == '__main__':
MyApp().run()
