B
B
bobrana2022-02-26 17:03:43
Python
bobrana, 2022-02-26 17:03:43

TelegramBotAPI How to make image pagination with PythonTelegramBotPagination library?

I read examples with pagination of text, but did not find pagination of pictures (which open from disk), which caused a problem with the output operator. I am attaching an excerpt of my erroneous code, maybe something in it just needs to be corrected.

place1_pages = [
    {
        'name':'\N{Potted Plant} 90',
        'image':'imagine/41.jpg',
    },
    {
        'name':'1',
        'image':'imagine/1.jpg',
]

places_data = place1_pages[page-1]

bot.send_photo(
        message.chat.id,
        open(places_data.get('image'), 'rb'), caption =places_data.get('name'),
        reply_markup=paginator.markup,
        parse_mode='Markdown')

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question