def get_kb_categories(): list_category = get_list_categories() keyboard = InlineKeyboardMarkup(row_width=3) for i in list_category: keyboard.insert( InlineKeyboardButton(text=i, callback_data=cdb_menu_category.new(key=i))) keyboard.add( InlineKeyboardButton(text='<<< Назад', callback_data=cdb_menu_category.new(key='Back'))) keyboard.add( InlineKeyboardButton(text='Выход', callback_data=cdb_menu_category.new(key='Exit'))) return keyboard
def get_kb_expenses_from_category(category: str): category_1 = get_category_from_str(category) expenses = get_name_expenses_from_category_generator(category_1) keyboard = InlineKeyboardMarkup( row_width=4, inline_keyboard=[[ InlineKeyboardButton( text='<Назад', callback_data=cdb_menu_exp_from_category_paginate.new( key='Expenses_paginator_back')), InlineKeyboardButton( text='Вперед>', callback_data=cdb_menu_exp_from_category_paginate.new( key='Expenses_paginator_next')) ]]) keyboard.add(*[ InlineKeyboardButton(text=i.title(), callback_data=cdb_menu_category.new(key=i)) for i in expenses ]) keyboard.row( InlineKeyboardButton( text='Добавить категорию расхода', callback_data=cdb_menu_exp_from_category_paginate.new( key='Add_category_exp')), InlineKeyboardButton( text='<<< Назад', callback_data=cdb_menu_exp_from_category_paginate.new( key='Back_exp')), InlineKeyboardButton( text='Выход', callback_data=cdb_menu_exp_from_category_paginate.new(key='Exit'))) return keyboard
def test12312(expenses): keyboard = InlineKeyboardMarkup( row_width=4, inline_keyboard=[[ InlineKeyboardButton( text='<Назад', callback_data=cdb_menu_exp_from_category_paginate.new( key='Expenses_paginator_back')), InlineKeyboardButton( text='Вперед>', callback_data=cdb_menu_exp_from_category_paginate.new( key='Expenses_paginator_next')) ]]) keyboard.add(*[ InlineKeyboardButton(text=str(i).title(), callback_data=cdb_menu_category.new(key=i)) for i in expenses ]) keyboard.row( InlineKeyboardButton( text='Добавить категорию расхода', callback_data=cdb_menu_exp_from_category_paginate.new( key='Add_category_exp')), InlineKeyboardButton( text='<<< Назад', callback_data=cdb_menu_exp_from_category_paginate.new( key='Back_exp')), InlineKeyboardButton( text='Выход', callback_data=cdb_menu_exp_from_category_paginate.new(key='Exit'))) return keyboard
]) inline_keyboard_main_category = InlineKeyboardMarkup(inline_keyboard=[ [ InlineKeyboardButton(text='Все расходы', callback_data=cdb_menu_category.new(key='All_exp')), InlineKeyboardButton(text='Последние 5 расходов', callback_data=cdb_menu_category.new(key='Last_5_exp')), ], [ InlineKeyboardButton(text='Расход за день', callback_data=cdb_menu_category.new(key='Day_exp')), InlineKeyboardButton(text='Расход за неделю', callback_data=cdb_menu_category.new(key='Medely_exp')) ], [ InlineKeyboardButton(text='Расход за месяц', callback_data=cdb_menu_category.new(key='Monz_exp')), InlineKeyboardButton(text='Расход за год', callback_data=cdb_menu_category.new(key='Year_exp')), ] , [ InlineKeyboardButton(text='Выход', callback_data='Cancel') ] ])