У меня есть таблица с 21 строкой, которая называется расходами. Я хочу вставить все строки таблицы в текстовый ярлык kivy. Но это показывает только последний ряд. Я потратил часы на это. Но я не смог найти решение. Могу ли я добавить метку для каждой строки с подчеркиванием. Что я могу сделать для этого?
Это часть кода в файле py.
q_e_n = "select count(*) from expences where month="+"'"+month+"'"+";"
q_e = "select index, date, details, amount from expences where month="+"'"+month+"'"+";"
cursor.execute(q_e_n)
e_n, = cursor.fetchone()
cursor.execute(q_e)
expences = cursor.fetchall()
cursor.execute("commit;")
Builder.load_file('total_wealth.kv')
class Money_Manager(App, FloatLayout):
fulldate = StringProperty()
total_income = StringProperty()
total_expences = StringProperty()
cash = StringProperty()
savings = StringProperty()
t_w = StringProperty()
index = StringProperty()
date = StringProperty()
details = StringProperty()
amount = StringProperty()
index2= NumericProperty()
def build(self):
i = 1
for row in expences:
index_amount = str(i)
date_amount = str(row[1])
details_amount = str(row[2])
amount_amount = str(row[3])
i = i+1
self.index = index_amount
self.date = date_amount
self.details = details_amount
self.amount = amount_amount
self.fulldate = (month+", "+date)
self.total_income = str(total_income_amount)
self.total_expences = str(total_expences_amount)
self.cash = str(cash_amount)
self.savings = str(savings_amount)
self.t_w = str(cash_amount+savings_amount)
return self
Money_Manager().run()
Это код в файле kv.
ScrollView:
size_hint: (.4,.6)
do_scroll_x: False
do_scroll_y: True
pos: 30,30
Label:
size_hint_y: None
height: self.texture_size[1]
text: app.index+") "+app.date+" "+app.details+" "+app.amount +'\n'
haligh: 'left'