<gh_stars>0

from aiogram.types import (InlineKeyboardButton,
                            InlineKeyboardMarkup,)

import json

from json_func import Json
class Keyboards:

    # Сreating a reply keyboard for add a new plant
    add_a_new_plant_keyboard = InlineKeyboardMarkup(resize_keyboard=True).add(

        InlineKeyboardButton(text='Добавить новое растение🪴', callback_data='new_plant'),
        
        )

    def my_plants_keyboard(self):
        data_len = Json(file_path="plants.json").len_()

        plants_keyboard = InlineKeyboardMarkup(resize_keyboard=True)

        for _ in range(data_len):

            with open('plants.json', encoding='utf-8') as read_file:

                name_plant = json.load(read_file)["plants"][_]["name"]
                print(type(name_plant))
                print(name_plant)

                plants_keyboard.add(
                    InlineKeyboardButton(text=f'{name_plant}', callback_data=f'{name_plant}')
                )

        return plants_keyboard
from aiogram.types import (InlineKeyboardButton,
                            InlineKeyboardMarkup,)

import json

from json_func import Json
class Keyboards:

    # Сreating a reply keyboard for add a new plant
    add_a_new_plant_keyboard = InlineKeyboardMarkup(resize_keyboard=True).add(

        InlineKeyboardButton(text='Добавить новое растение🪴', callback_data='new_plant'),
        
        )

    def my_plants_keyboard(self):
        data_len = Json(file_path="plants.json").len_()

        plants_keyboard = InlineKeyboardMarkup(resize_keyboard=True)

        for _ in range(data_len):

            with open('plants.json', encoding='utf-8') as read_file:

                name_plant = json.load(read_file)["plants"][_]["name"]
                print(type(name_plant))
                print(name_plant)

                plants_keyboard.add(
                    InlineKeyboardButton(text=f'{name_plant}', callback_data=f'{name_plant}')
                )

        return plants_keyboard
# Сreating a reply keyboard for add a new plant