Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pykeyboard

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pykeyboard

Best Keyboard and Pagination for the Pyrogram Library.

  • 0.1.5
  • PyPI
  • Socket score

Maintainers
1

pykeyboard

PyPI Downloads GitHub

🎉 Thank you for 100k downloads 🎉 I love you...🥰

Pykeyboard

What's new?

  • Overriding the KeyboardButton, ReplyKeyboardRemove, ForceReply, InlineKeyboardButton methods in ReplyButton, ReplyKeyboardRemove, ForceReply, InlineButton.
  • Added new method InlineKeyboard. To send language selection keyboard.
  • Minor changes due to update in Pyrogram.

Installation

pip install pykeyboard

Documentation

Inline Keyboard

from pykeyboard import InlineKeyboard
Parameters:
  • row_width (integer, default 3)

Inline Keyboard add buttons

Code
from pykeyboard import InlineKeyboard, InlineButton


keyboard = InlineKeyboard(row_width=3)
keyboard.add(
    InlineButton('1', 'inline_keyboard:1'),
    InlineButton('2', 'inline_keyboard:2'),
    InlineButton('3', 'inline_keyboard:3'),
    InlineButton('4', 'inline_keyboard:4'),
    InlineButton('5', 'inline_keyboard:5'),
    InlineButton('6', 'inline_keyboard:6'),
    InlineButton('7', 'inline_keyboard:7')
)
Result

add_inline_button

Inline Keyboard row buttons

Code
from pykeyboard import InlineKeyboard, InlineButton


keyboard = InlineKeyboard()
keyboard.row(InlineButton('1', 'inline_keyboard:1'))
keyboard.row(
    InlineButton('2', 'inline_keyboard:2'),
    InlineButton('3', 'inline_keyboard:3')
)
keyboard.row(InlineButton('4', 'inline_keyboard:4'))
keyboard.row(
    InlineButton('5', 'inline_keyboard:5'),
    InlineButton('6', 'inline_keyboard:6')
)
Result

row_inline_button

Pagination inline keyboard

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

keyboard = InlineKeyboard()
keyboard.paginate(3, 3, 'pagination_keyboard:{number}')
Result

pagination_keyboard_3

Pagination 5 pages
Code
from pykeyboard import InlineKeyboard

keyboard = InlineKeyboard()
keyboard.paginate(5, 3, 'pagination_keyboard:{number}')
Result

pagination_keyboard_5

Pagination 9 pages
Code
from pykeyboard import InlineKeyboard

keyboard = InlineKeyboard()
keyboard.paginate(9, 5, 'pagination_keyboard:{number}')
Result

pagination_keyboard_9

Pagination 100 pages
Code
from pykeyboard import InlineKeyboard

keyboard = InlineKeyboard()
keyboard.paginate(100, 100, 'pagination_keyboard:{number}')
Result

pagination_keyboard_100

Pagination 150 pages and buttons
Code
from pykeyboard import InlineKeyboard, InlineButton

keyboard = InlineKeyboard()
keyboard.paginate(150, 123, 'pagination_keyboard:{number}')
keyboard.row(
    InlineButton('Back', 'pagination_keyboard:back'),
    InlineButton('Close', 'pagination_keyboard:close')
)
Result

pagination_keyboard_150

Languages inline keyboard

from pykeyboard import InlineKeyboard
Parameters:
  • callback_pattern (string) - use of the {locale} pattern is required
  • locales (string | list) - list of language codes
    • be_BY - Belarusian
    • de_DE - German
    • zh_CN - Chinese
    • en_US - English
    • fr_FR - French
    • id_ID - Indonesian
    • it_IT - Italian
    • ko_KR - Korean
    • tr_TR - Turkish
    • ru_RU - Russian
    • es_ES - Spanish
    • uk_UA - Ukrainian
    • uz_UZ - Uzbek
  • row_width (integer, default 2)

P.S. To add new languages, write to me in @PyMaster telegram.

Code
from pykeyboard import InlineKeyboard


keyboard = InlineKeyboard(row_width=3)
keyboard.languages(
    'languages:{locale}', ['en_US', 'ru_RU', 'id_ID'], 2
)
Result

languages_keyboard

Reply Keyboard

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
from pykeyboard import ReplyKeyboard, ReplyButton


keyboard = ReplyKeyboard(row_width=3)
keyboard.add(
    ReplyButton('Reply button 1'),
    ReplyButton('Reply button 2'),
    ReplyButton('Reply button 3'),
    ReplyButton('Reply button 4'),
    ReplyButton('Reply button 5')
)
Result

add_reply_button

Reply Keyboard row buttons

Code
from pykeyboard import ReplyKeyboard, ReplyButton


keyboard = ReplyKeyboard()
keyboard.row(ReplyButton('Reply button 1'))
keyboard.row(
    ReplyButton('Reply button 2'),
    ReplyButton('Reply button 3')
)
keyboard.row(ReplyButton('Reply button 4'))
keyboard.row(ReplyButton('Reply button 5'))
Result

row_reply_button

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc