tgitem = result()
TypeError: 'tuple' object is not callable
def item_kb():
tg = InlineKeyboardMarkup(row_width=1)
tgitem = result()
for tovar in tgitem:
btn_text = f'{tovar.name} | {tovar.price} | {tovar.colvo}'
tg1 = InlineKeyboardButton(text=btn_text, callback_data='tg')
tg.add(tg1)
def get_item():
with conn:
result = cursor.execute("SELECT id, name, price, colvo FROM tovars").fetchone()
return result
result = get_item()
result = cursor.execute("SELECT id, name, price, colvo FROM tovars").fetchone()
return result
result = get_item()
tgitem = result()
TypeError: 'tuple' object is not callable
get_item
не вносить в переменную result
, т.е код получился таким:def item_kb():
tg = InlineKeyboardMarkup(row_width=1)
tgitem = get_item()
for tovar in tgitem:
btn_text = f'{tovar[0]} | {tovar[1]} | {tovar[2]}'
tg1 = InlineKeyboardButton(text=btn_text, callback_data='tg')
tg.add(tg1)
return tg
def get_item():
with conn:
result = cursor.execute("SELECT id, name, price, colvo FROM tovars").fetchall()
return result