This repository has been archived on 2024-10-14. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
2020-06-11 01:04:30 +03:00
docs/source/images Add files via upload 2020-06-11 00:45:45 +03:00
examples Add files via upload 2020-06-11 01:04:30 +03:00
pykeyboard Add files via upload 2020-06-11 01:04:30 +03:00
.gitignore Update .gitignore 2020-06-10 06:24:18 +03:00
LICENSE Add files via upload 2020-06-11 01:04:30 +03:00
README.md Add files via upload 2020-06-11 01:04:30 +03:00
requirements.txt Add files via upload 2020-06-11 01:04:30 +03:00
setup.py Add files via upload 2020-06-11 01:04:30 +03:00

Pykeyboard

Installation

pip install pykeyboard

Documentation

Inline Keyboard

from pykeyboard import InlineKeyboard

Inline Keyboard add buttons

Code
from pykeyboard import InlineKeyboard
from pyrogram 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
from pykeyboard import InlineKeyboard
from pyrogram 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

Reply Keyboard

from pykeyboard import ReplyKeyboard

Reply Keyboard add buttons

Code
from pykeyboard import ReplyKeyboard
from pyrogram 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
from pykeyboard import ReplyKeyboard
from pyrogram 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

Pagination inline keyboard

from pykeyboard import InlinePaginationKeyboard

Pagination 3 pages

Code
from pykeyboard import InlinePaginationKeyboard


keyboard = InlinePaginationKeyboard(3, 3, 'pagination_keyboard#{number}')
Result

pagination_keyboard_3

Pagination 5 pages

Code
from pykeyboard import InlinePaginationKeyboard


keyboard = InlinePaginationKeyboard(5, 3, 'pagination_keyboard#{number}')
Result

pagination_keyboard_5

Pagination 9 pages

Code
from pykeyboard import InlinePaginationKeyboard


keyboard = InlinePaginationKeyboard(9, 5, 'pagination_keyboard#{number}')
Result

pagination_keyboard_9

Pagination 25 pages

Code
from pykeyboard import InlinePaginationKeyboard


keyboard = InlinePaginationKeyboard(25, 14, 'pagination_keyboard#{number}')
Result

pagination_keyboard_25

Pagination 100 pages

Code
from pykeyboard import InlinePaginationKeyboard


keyboard = InlinePaginationKeyboard(100, 100, 'pagination_keyboard#{number}')
Result

pagination_keyboard_100

Pagination 150 pages and buttons

Code
from pykeyboard import InlinePaginationKeyboard
from pyrogram import InlineKeyboardButton


keyboard = InlinePaginationKeyboard(150, 123, 'pagination_keyboard#{number}')
keyboard.row(
    InlineKeyboardButton('Back', 'pagination_keyboard#back'),
    InlineKeyboardButton('Close', 'pagination_keyboard#close')
)
Result

pagination_keyboard_150