Answer the question
In order to leave comments, you need to log in
How to generate buttons in aiogram?
def btn_orders():
keys = InlineKeyboardMarkup(row_width=2)
data_list = retrun_items()
for i in range(len(data_list)):
data = data_list[i][0]
keys.row(InlineKeyboardButton(text=data_list[i][1], callback_data=f'order_{data}'))
return keys
Answer the question
In order to leave comments, you need to log in
Probably a for loop. Put all the values and button names in a list, and iterate through this list with a for loop.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question