from kivymd.app import MDApp
from kivymd.uix.bottomnavigation import MDBottomNavigation, MDBottomNavigationItem
from kivymd.uix.label import MDLabel
from kivymd.uix.screen import MDScreen
class Test(MDApp):
text_string = "Changed text"
def build(self):
self.theme_cls.material_style = "M3"
self.theme_cls.theme_style = "Dark"
self.label = MDLabel(text='Example')
return (
MDScreen(
MDBottomNavigation(self.label)
)
)
def on_start(self):
self.label.text = self.text_string
Test().run()
add_callback_query_handler(handler_dict)
Adds a callback request handler Note that you should use register_callback_query_handler to add callback_query_handler to the bot.
PARAMETERS
handler_dict –
RETURNS
import telebot
from telebot import types
bot = telebot.TeleBot('-----')
@bot.message_handler(commands=['start'])
def button(message):
markup = types.InlineKeyboardMarkup(row_width=2)
item = types.InlineKeyboardButton('start', callback_data='start')
item2 = types.InlineKeyboardButton('sixes', callback_data='sixes')
item3 = types.InlineKeyboardButton('info', callback_data='info')
item4 = types.InlineKeyboardButton('creator', callback_data='creator')
markup.add(item, item2, item3, item4)
bot.send_message(message.chat.id, '------', reply_markup=markup)
@bot.callback_query_handler(func=lambda call:True)
def callback(call):
if call.message:
if call.data == 'start':
bot.send_message(call.message.caht.id, '-------')
bot.polling(none_stop=True)
print('Привет я бот по поиску игр по жанру')
print('Я спрашиваю какой вам нравится жанр и советую игры по этому жанру')
print('Какой вам нравится жанр игр? (экшен-игры,мморпг)')
perem = input("")
while perem != 'stop':
if perem == "экшен-игры":
print("Советую вам поиграть в такие проекты как: Minecraft, Battlefield 3")
break
elif perem == "мморпг":
print("Советую вам поиграть в такие проекты как: Perfect World, World of Warcraft")
break
else:
print('Не найдено жанра попробуйте еше раз')
perem = input("")