telegram.InlineKeyboardMarkup

class telegram.InlineKeyboardMarkup(inline_keyboard: List[List[telegram.inline.inlinekeyboardbutton.InlineKeyboardButton]], **_kwargs)

Bases: telegram.replymarkup.ReplyMarkup

This object represents an inline keyboard that appears right next to the message it belongs to.

Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their the size of inline_keyboard and all the buttons are equal.

Parameters:
  • inline_keyboard (List[List[telegram.InlineKeyboardButton]]) – List of button rows, each represented by a list of InlineKeyboardButton objects.
  • **kwargs (dict) – Arbitrary keyword arguments.
inline_keyboard

List of button rows, each represented by a list of InlineKeyboardButton objects.

Type:List[List[telegram.InlineKeyboardButton]]
classmethod from_button(button: telegram.inline.inlinekeyboardbutton.InlineKeyboardButton, **kwargs) → telegram.inline.inlinekeyboardmarkup.InlineKeyboardMarkup

Shortcut for:

InlineKeyboardMarkup([[button]], **kwargs)

Return an InlineKeyboardMarkup from a single InlineKeyboardButton

Parameters:
classmethod from_column(button_column: List[telegram.inline.inlinekeyboardbutton.InlineKeyboardButton], **kwargs) → telegram.inline.inlinekeyboardmarkup.InlineKeyboardMarkup

Shortcut for:

InlineKeyboardMarkup([[button] for button in button_column], **kwargs)

Return an InlineKeyboardMarkup from a single column of InlineKeyboardButtons

Parameters:
classmethod from_row(button_row: List[telegram.inline.inlinekeyboardbutton.InlineKeyboardButton], **kwargs) → telegram.inline.inlinekeyboardmarkup.InlineKeyboardMarkup

Shortcut for:

InlineKeyboardMarkup([button_row], **kwargs)

Return an InlineKeyboardMarkup from a single row of InlineKeyboardButtons

Parameters: