Name | aiogram2252-page JSON |
Version |
0.0.4
JSON |
| download |
home_page | |
Summary | Inline pagination for aiogram 2.25.2 |
upload_time | 2024-02-07 15:06:38 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.11 |
license | |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# AiogramPaginationInline 2.25.2
## Description
A simple library for aiogram 2.25.2 that allows you to easily do pagination for any Inline keyboards.
Install for pip:
```shell
pip install aiogram2252-page
```
## Create paginations object
```python
from aiogram2252_page.paginator import Paginator
from aiogram import types
kb = types.InlineKeyboardMarkup()
paginator = Paginator(data=kb, size=5)
```
### Params
**data**: Any ready-to-use keyboard InlineKeyboardMarkup or any iterable object with InlineKeyboardButton.
**size**: The number of rows of buttons on one page, excluding the navigation bar.
### Return
A paginator object that, when called, returns a ready-made keyboard with pagination.
## Get data for registrations handler paginator
```python
from aiogram2252_page.paginator import Paginator
from aiogram import types
kb = types.InlineKeyboardMarkup()
paginator = Paginator(data=kb, size=5)
@dp.message_handler()
async def some_func(message: types.Message):
await message.answer(
text='Pagination ',
reply_markup=paginator()
)
```
### Return paginator_handler()
Data for registrations paginator.
## Example
```python
import random
from aiogram import Bot, Dispatcher, types
from aiogram.contrib.fsm_storage.memory import MemoryStorage
from aiogram.dispatcher.filters import CommandStart
from aiogram.utils.executor import Executor
from aiogram2252_page.paginator import Paginator
token = ''
storage = MemoryStorage()
bot = Bot(token=token)
dp = Dispatcher(bot, storage=storage)
@dp.message_handler(CommandStart(), state='*')
async def start(message: types.Message):
await message.answer('Hello world!')
'''row_width - this parameter indicates the number of columns in the pagination'''
kb = types.InlineKeyboardMarkup(row_width=2)
kb.add(
*[
types.InlineKeyboardButton(
text=str(random.randint(1000000, 10000000)),
callback_data='pass'
) for i in range(100)
]
)
'''size is a parameter that indicates the number of rows in a column'''
paginator = Paginator(data=kb, size=5, dp=dp, callback_startswith="page:")
await message.answer(
text='Paginator',
reply_markup=paginator()
)
if __name__ == '__main__':
Executor(dp).start_polling()
```
## Screenshots
First page:

Second page:

Last page:

Clicking on the current page number returns to the first page

*The order of entries is not lost.*
## License MIT
Raw data
{
"_id": null,
"home_page": "",
"name": "aiogram2252-page",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": "",
"keywords": "",
"author": "",
"author_email": "llimonix <llimonix123@yandex.com>",
"download_url": "https://files.pythonhosted.org/packages/2e/7c/c9ca2d9bde945f95d6c04af2999f480f23f651725243caadc4af7520f81f/aiogram2252_page-0.0.4.tar.gz",
"platform": null,
"description": "# AiogramPaginationInline 2.25.2\r\n\r\n## Description\r\n\r\nA simple library for aiogram 2.25.2 that allows you to easily do pagination for any Inline keyboards.\r\n\r\nInstall for pip:\r\n\r\n```shell\r\npip install aiogram2252-page\r\n```\r\n\r\n## Create paginations object\r\n\r\n```python\r\nfrom aiogram2252_page.paginator import Paginator\r\nfrom aiogram import types\r\n\r\nkb = types.InlineKeyboardMarkup()\r\npaginator = Paginator(data=kb, size=5)\r\n```\r\n\r\n### Params\r\n\r\n**data**: Any ready-to-use keyboard InlineKeyboardMarkup or any iterable object with InlineKeyboardButton.\r\n\r\n**size**: The number of rows of buttons on one page, excluding the navigation bar.\r\n\r\n### Return\r\n\r\nA paginator object that, when called, returns a ready-made keyboard with pagination.\r\n\r\n## Get data for registrations handler paginator\r\n\r\n```python\r\nfrom aiogram2252_page.paginator import Paginator\r\nfrom aiogram import types\r\n\r\nkb = types.InlineKeyboardMarkup()\r\npaginator = Paginator(data=kb, size=5)\r\n\r\n\r\n@dp.message_handler()\r\nasync def some_func(message: types.Message):\r\n await message.answer(\r\n text='Pagination ',\r\n reply_markup=paginator()\r\n )\r\n```\r\n\r\n### Return paginator_handler()\r\n\r\nData for registrations paginator.\r\n\r\n## Example\r\n\r\n```python\r\nimport random\r\n\r\nfrom aiogram import Bot, Dispatcher, types\r\nfrom aiogram.contrib.fsm_storage.memory import MemoryStorage\r\nfrom aiogram.dispatcher.filters import CommandStart\r\nfrom aiogram.utils.executor import Executor\r\n\r\nfrom aiogram2252_page.paginator import Paginator\r\n\r\ntoken = ''\r\n\r\nstorage = MemoryStorage()\r\nbot = Bot(token=token)\r\ndp = Dispatcher(bot, storage=storage)\r\n\r\n\r\n@dp.message_handler(CommandStart(), state='*')\r\nasync def start(message: types.Message):\r\n await message.answer('Hello world!')\r\n\r\n '''row_width - this parameter indicates the number of columns in the pagination'''\r\n kb = types.InlineKeyboardMarkup(row_width=2)\r\n\r\n\r\n kb.add(\r\n *[\r\n types.InlineKeyboardButton(\r\n text=str(random.randint(1000000, 10000000)),\r\n callback_data='pass'\r\n ) for i in range(100)\r\n ]\r\n )\r\n '''size is a parameter that indicates the number of rows in a column'''\r\n paginator = Paginator(data=kb, size=5, dp=dp, callback_startswith=\"page:\")\r\n await message.answer(\r\n text='Paginator',\r\n reply_markup=paginator()\r\n )\r\n\r\n\r\nif __name__ == '__main__':\r\n Executor(dp).start_polling()\r\n\r\n```\r\n\r\n## Screenshots\r\n\r\nFirst page:\r\n\r\n\r\n\r\nSecond page:\r\n\r\n\r\n\r\nLast page:\r\n\r\n\r\n\r\nClicking on the current page number returns to the first page\r\n\r\n\r\n\r\n*The order of entries is not lost.*\r\n\r\n## License MIT\r\n",
"bugtrack_url": null,
"license": "",
"summary": "Inline pagination for aiogram 2.25.2",
"version": "0.0.4",
"project_urls": {
"Homepage": "https://github.com/llimonix/aiogram-pagination-inline-2.25.2",
"Issues": "https://github.com/llimonix/aiogram-pagination-inline-2.25.2/issues"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "80f6ee13085f37a1b5425619a4124baa7a25affc3cc2604a326179ef697a4f45",
"md5": "76007de2f110445df79854330ca974dd",
"sha256": "abe2257aaee79a765545b69ef33e5a001e46e07f9643e9202cdadde70096ffdc"
},
"downloads": -1,
"filename": "aiogram2252_page-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "76007de2f110445df79854330ca974dd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 5115,
"upload_time": "2024-02-07T15:06:36",
"upload_time_iso_8601": "2024-02-07T15:06:36.452593Z",
"url": "https://files.pythonhosted.org/packages/80/f6/ee13085f37a1b5425619a4124baa7a25affc3cc2604a326179ef697a4f45/aiogram2252_page-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2e7cc9ca2d9bde945f95d6c04af2999f480f23f651725243caadc4af7520f81f",
"md5": "de3ca39d1b9e6322db0640d9fdbbec8a",
"sha256": "3cd5810ef7d955d37a035e41a125c2ad6920c3dd537ba17146bea70249af0a2d"
},
"downloads": -1,
"filename": "aiogram2252_page-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "de3ca39d1b9e6322db0640d9fdbbec8a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 4742,
"upload_time": "2024-02-07T15:06:38",
"upload_time_iso_8601": "2024-02-07T15:06:38.503444Z",
"url": "https://files.pythonhosted.org/packages/2e/7c/c9ca2d9bde945f95d6c04af2999f480f23f651725243caadc4af7520f81f/aiogram2252_page-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-07 15:06:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "llimonix",
"github_project": "aiogram-pagination-inline-2.25.2",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "aiogram2252-page"
}