Answer the question
In order to leave comments, you need to log in
How to make InlineKeyboardMarkup in one line?
Hi everybody! Now the buttons are in a row - I want to make them in one line
in the photo, an example of how it is now and how I would like to do it.
python telegrambotapi
This is how it is now
This is how I want to do
this is my code:
@bot.message_handler(commands=['start'])
def start_handler(message):
keyboard = types.InlineKeyboardMarkup(row_width=1)
url_button = types.InlineKeyboardButton(text="текст", url="https://t.me/")
url_buttons = types.InlineKeyboardButton(text="текст", url="https://t.me/")
url_buttons1 = types.InlineKeyboardButton(text="текст", url="https://t.me/")
keyboard.add(url_button)
keyboard.add(url_buttons)
keyboard.add(url_buttons1)
bot.send_message(message.chat.id, f'Приветствую тебя, {message.from_user.first_name}!')
bot.send_message(message.chat.id, "ТЕКСТ", reply_markup=keyboard)
Answer the question
In order to leave comments, you need to log in
You yourself set the number of buttons in a row to 1
row_width=1
keyboard.add(url_button)
keyboard.add(url_buttons)
keyboard.add(url_buttons1)
keyboard = types.InlineKeyboardMarkup(row_width=3)
keyboard.add(url_button, url_buttons, url_buttons1)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question