Answer the question
In order to leave comments, you need to log in
How to adjust inline_keyboard width of Telegram Bot API buttons?
The task is to divide the inline_keyboard buttons into different lines, that is, not two buttons in a line, but several vertically.
As far as I understand, this is done through arrays, but for some reason it doesn’t work for me, please tell me what I’m doing, no, here’s the code:
tgQuery("sendMessage", array('chat_id' => $chat_id, 'text' => 'Выбери свою галактику:',
'reply_markup' => json_encode(array('inline_keyboard' =>
))
));
Answer the question
In order to leave comments, you need to log in
menu = types.InlineKeyboardMarkup()
bot.send_message(message.chat.id, "TEXT", reply_markup=build_menu(menu))
def build_menu(menu):
menu.add(
types.InlineKeyboardButton('Milky Way', callback_data=' data'),
types.InlineKeyboardButton('Andromeda', callback_data='data')
)
menu.add(
types.InlineKeyboardButton('< Prev', callback_data='data'),
types.InlineKeyboardButton('Next > ^', callback_data ='data')
)
return menu
Build a menu with the Milky Way and Andromeda on the same line
next and prev on the other line
Build the menu via a function, where each "add" will assign a new line
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question