The code below shows how to access each of the textinputs. I have changed some of you variable names for clarity.
Setting write_tab to false allows you to tab between the text inputs.
from kivy.app import App
from kivy.uix.textinput import TextInput
from kivy.uix.boxlayout import BoxLayout
class Row(BoxLayout): # defines a row
def __init__(self, col_no=1, **k):
super().__init__(**k)
for i in range(col_no):
a = TextInput(multiline=0, write_tab=False) # set write_tab False to tab between textinput fields
self.add_widget(a)
class A(App):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.ss = None
def build(self):
self.ss = BoxLayout(orientation="vertical")
for i in range(10):
row = Row(col_no=10)
self.ss.add_widget(row)
return self.ss
def on_start(self):
print(f'The rows are in reverse order: {self.ss.children}')
print(f'Each row has text inputs, also in reverse order: {self.ss.children[0].children}')
rows = reversed(self.ss.children)
for r,row in enumerate(rows):
t_inputs = reversed(row.children)
for c, t_input in enumerate(t_inputs):
t_input.text = f'C{c}, R{r}'
A().run()
--
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/3ff60d51-fa34-4e7b-b6fa-f665463a0b5fo%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-...@googlegroups.com.
can i use enter key to go next text input than tab key…
That is not provided by the widget, but you could write the code to do that. If you’re going to create a spreadsheet-like object, you might consider going down the column on enter.
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/b5e9df4b-9eb7-4180-a1ce-094092532016o%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/5f37fd3f.1c69fb81.e3781.d07dSMTPIN_ADDED_MISSING%40gmr-mx.google.com.
It is quite straight forward. When you get the on_text_validate event, set the focus on the TextInput in the next column.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAABdqiEryLbCeXGDgOrPqhaJEhahdckHTbYJv2_fjX_HzPbxGg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/b5e9df4b-9eb7-4180-a1ce-094092532016o%40googlegroups.com.
--
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-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/5f37fd3f.1c69fb81.e3781.d07dSMTPIN_ADDED_MISSING%40gmr-mx.google.com.
--
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-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAABdqiEryLbCeXGDgOrPqhaJEhahdckHTbYJv2_fjX_HzPbxGg%40mail.gmail.com.
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/1c82a963-0970-44fb-b22d-c86bbff8bb8bo%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/1c82a963-0970-44fb-b22d-c86bbff8bb8bo%40googlegroups.com.
You consumed the iterator. One alternative is to convert the iterator into a list.
def on_start(self):
cols = reversed(self.ss.children)
x = list(cols)
for j in x:
print(j.children[0].children)
for r,col in enumerate(x):
print("hello")
t_inputs = reversed(col.children[0].children)
print(t_inputs)
for c, t_input in enumerate(t_inputs):
t_input.text = f'R{c}, C{r}'
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/7b4cc845-e006-4b9e-945c-8bb7cab5e84ao%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/7b4cc845-e006-4b9e-945c-8bb7cab5e84ao%40googlegroups.com.