S
S
SHADRIN2020-06-04 18:10:17
Python
SHADRIN, 2020-06-04 18:10:17

How to create keyboard buttons in a loop?

keyboard = types.ReplyKeyboardMarkup(row_width=4, resize_keyboard=True)
            for but in ['Кнопка 1', 'Кнопка 2', 'Кнопка 3']:
                keyboard.add(*[types.KeyboardButton(name) for name in[ but ]])

How to react like this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
ediboba, 2020-06-05
@shadrin_ss

markup = telebot.types.ReplyKeyboardMarkup(row_width=1, resize_keyboard=True)
for button in buttons:
    markup.row(button)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question