InlineKeyboardMarkup¶
- class telegram.InlineKeyboardMarkup(inline_keyboard, *, api_kwargs=None)[source]¶
Bases:
telegram.TelegramObject
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 size of
inline_keyboard
and all the buttons are equal.Use In
Available In
See also
Another kind of keyboard would be the
telegram.ReplyKeyboardMarkup
.Examples
- Parameters:
inline_keyboard (Sequence[Sequence[
telegram.InlineKeyboardButton
]]) –Sequence of button rows, each represented by a sequence of
InlineKeyboardButton
objects.Changed in version 20.0: Accepts any
collections.abc.Sequence
as input instead of just a list. The input is converted to a tuple.
- inline_keyboard[source]¶
Tuple of button rows, each represented by a tuple of
InlineKeyboardButton
objects.Changed in version 20.0: This attribute is now an immutable tuple.
- Type:
tuple[tuple[
telegram.InlineKeyboardButton
]]
- classmethod from_button(button, **kwargs)[source]¶
Shortcut for:
InlineKeyboardMarkup([[button]], **kwargs)
Return an InlineKeyboardMarkup from a single InlineKeyboardButton
- Parameters:
button (
telegram.InlineKeyboardButton
) – The button to use in the markup
- classmethod from_column(button_column, **kwargs)[source]¶
Shortcut for:
InlineKeyboardMarkup([[button] for button in button_column], **kwargs)
Return an InlineKeyboardMarkup from a single column of InlineKeyboardButtons
- Parameters:
button_column (Sequence[
telegram.InlineKeyboardButton
]) –The button to use in the markup
Changed in version 20.0: Accepts any
collections.abc.Sequence
as input instead of just a list.
- classmethod from_row(button_row, **kwargs)[source]¶
Shortcut for:
InlineKeyboardMarkup([button_row], **kwargs)
Return an InlineKeyboardMarkup from a single row of InlineKeyboardButtons
- Parameters:
button_row (Sequence[
telegram.InlineKeyboardButton
]) –The button to use in the markup
Changed in version 20.0: Accepts any
collections.abc.Sequence
as input instead of just a list.