pykeyboard

![PyPI](https://img.shields.io/pypi/v/pykeyboard) [![Downloads](https://pepy.tech/badge/pykeyboard)](https://pepy.tech/project/pykeyboard) ![GitHub](https://img.shields.io/github/license/pystorage/pykeyboard)
# Pykeyboard - [What's new?](#whats-new) - [Installation](#installation) - [Documentation](#documentation) - [Inline Keyboard](#inline-keyboard) - [Inline Keyboard add buttons](#inline-keyboard-add-buttons) - [Inline Keyboard row buttons](#inline-keyboard-row-buttons) - [Pagination inline keyboard](#pagination-inline-keyboard) - [Pagination 3 pages](#pagination-3-pages) - [Pagination 5 pages](#pagination-5-pages) - [Pagination 9 pages](#pagination-9-pages) - [Pagination 100 pages](#pagination-100-pages) - [Pagination 150 pages and buttons](#pagination-150-pages-and-buttons) - [Reply Keyboard](#reply-keyboard) - [Reply Keyboard add buttons](#reply-keyboard-add-buttons) - [Reply Keyboard row buttons](#reply-keyboard-row-buttons) # What's new? - Added a new method to InlineKeyboard for working with pagination. The InlinePaginationKeyboard class will be removed in a future version. # Installation ```shell pip install pykeyboard ``` # Documentation ## Inline Keyboard ```python from pykeyboard import InlineKeyboard ``` ##### Parameters: - row_width (integer, default 3) ### Inline Keyboard add buttons #### Code ```python from pykeyboard import InlineKeyboard from pyrogram.types import InlineKeyboardButton keyboard = InlineKeyboard(row_width=3) keyboard.add( InlineKeyboardButton('1', 'inline_keyboard#1'), InlineKeyboardButton('2', 'inline_keyboard#2'), InlineKeyboardButton('3', 'inline_keyboard#3'), InlineKeyboardButton('4', 'inline_keyboard#4'), InlineKeyboardButton('5', 'inline_keyboard#5'), InlineKeyboardButton('6', 'inline_keyboard#6'), InlineKeyboardButton('7', 'inline_keyboard#7') ) ``` #### Result

add_inline_button

### Inline Keyboard row buttons #### Code ```python from pykeyboard import InlineKeyboard from pyrogram.types import InlineKeyboardButton keyboard = InlineKeyboard() keyboard.row(InlineKeyboardButton('1', 'inline_keyboard#1')) keyboard.row( InlineKeyboardButton('2', 'inline_keyboard#2'), InlineKeyboardButton('3', 'inline_keyboard#3') ) keyboard.row(InlineKeyboardButton('4', 'inline_keyboard#4')) keyboard.row( InlineKeyboardButton('5', 'inline_keyboard#5'), InlineKeyboardButton('6', 'inline_keyboard#6') ) ``` #### Result

row_inline_button

### Pagination inline keyboard ```python from pykeyboard import InlineKeyboard ``` #### Parameters: - count_pages (integer) - current_page (integer) - callback_pattern (string) - use of the `{number}` pattern is required #### Pagination 3 pages #### Code ```python from pykeyboard import InlineKeyboard keyboard = InlineKeyboard() keyboard.paginate(3, 3, 'pagination_keyboard#{number}') ``` #### Result

pagination_keyboard_3

#### Pagination 5 pages #### Code ```python from pykeyboard import InlineKeyboard keyboard = InlineKeyboard() keyboard.paginate(5, 3, 'pagination_keyboard#{number}') ``` #### Result

pagination_keyboard_5

#### Pagination 9 pages #### Code ```python from pykeyboard import InlineKeyboard keyboard = InlineKeyboard() keyboard.paginate(9, 5, 'pagination_keyboard#{number}') ``` #### Result

pagination_keyboard_9

#### Pagination 100 pages #### Code ```python from pykeyboard import InlineKeyboard keyboard = InlineKeyboard() keyboard.paginate(100, 100, 'pagination_keyboard#{number}') ``` #### Result

pagination_keyboard_100

#### Pagination 150 pages and buttons #### Code ```python from pykeyboard import InlineKeyboard from pyrogram.types import InlineKeyboardButton keyboard = InlineKeyboard() keyboard.paginate(150, 123, 'pagination_keyboard#{number}') keyboard.row( InlineKeyboardButton('Back', 'pagination_keyboard#back'), InlineKeyboardButton('Close', 'pagination_keyboard#close') ) ``` #### Result

pagination_keyboard_150

## Reply Keyboard ```python from pykeyboard import ReplyKeyboard ``` #### Parameters: - resize_keyboard (bool, optional) - one_time_keyboard (bool, optional) - selective (bool, optional) - row_width (integer, default 3) ### Reply Keyboard add buttons #### Code ```python from pykeyboard import ReplyKeyboard from pyrogram.types import KeyboardButton keyboard = ReplyKeyboard(row_width=3) keyboard.add( KeyboardButton('1', 'reply_keyboard#1'), KeyboardButton('2', 'reply_keyboard#2'), KeyboardButton('3', 'reply_keyboard#3'), KeyboardButton('4', 'reply_keyboard#4'), KeyboardButton('5', 'reply_keyboard#5'), ) ``` #### Result

add_reply_button

### Reply Keyboard row buttons #### Code ```python from pykeyboard import ReplyKeyboard from pyrogram.types import KeyboardButton keyboard = ReplyKeyboard() keyboard.row(KeyboardButton('1', 'reply_keyboard#1')) keyboard.row( KeyboardButton('2', 'reply_keyboard#2'), KeyboardButton('3', 'reply_keyboard#3') ) keyboard.row(KeyboardButton('4', 'reply_keyboard#4')) keyboard.row(KeyboardButton('5', 'reply_keyboard#5')) ``` #### Result

row_reply_button