A
A
Alex_8882020-05-17 15:48:17
Python
Alex_888, 2020-05-17 15:48:17

How to arrange InlineKeyboardButton in two columns?

I can’t arrange buttons in two columns, it doesn’t react to the row_width=2 parameter in any way

stringList = {"1": "Один", "2": "Два", "3": "Три", "4": "Четыре", "5": "Пять"}

def makeKeyboard():
markup = types.InlineKeyboardMarkup(row_width=2)
for key, value in stringList.items():
     markup.add(types.InlineKeyboardButton(text=value,callback_data="['value', '" + value + "', '" + key + "']"))
return markup

def handle_area(call):
    bot.send_message(chat_id=call.message.chat.id,
                     text='hello:' 
                     reply_markup=makeKeyboard(call))

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question