Python
6
Вклад в тег
@bot.message_handler(commands=["start"])
def inline(message):
key = types.InlineKeyboardMarkup()
but_1 = types.InlineKeyboardButton(text="NumberOne", callback_data="NumberOne")
but_2 = types.InlineKeyboardButton(text="NumberTwo", callback_data="NumberTwo")
but_3 = types.InlineKeyboardButton(text="NumberTree", callback_data="NumberTree")
key.add(but_1, but_2, but_3)
bot.send_message(message.chat.id, "ВЫБЕРИТЕ КНОПКУ", reply_markup=key)
@bot.callback_query_handler(func=lambda c:True)
def inline(c):
if c.data == 'NumberOne':
bot.send_message(c.message.chat.id, 'Это кнопка 1')
if c.data == 'NumberTwo':
bot.send_message(c.message.chat.id, 'Это кнопка 2')
if c.data == 'NumberTree':
key = types.InlineKeyboardMarkup()
but_1 = types.InlineKeyboardButton(text="NumberOne", callback_data="NumberOne")
but_2 = types.InlineKeyboardButton(text="NumberTwo", callback_data="NumberTwo")
but_3 = types.InlineKeyboardButton(text="NumberTree", callback_data="NumberTree")
key.add(but_1, but_2, but_3)
bot.send_message(c.message.chat.id, 'Это кнопка 3', reply_markup=key)
import os
@bot.message_handler(commands=["stop"])
def stop(message):
if message.from_user.username == cfg.Father:
pid = str(os.getpid())
stoper = open('ozerx/stoper.bat', 'w')
stoper.write("Taskkill /PID " + pid + " /F")
stoper.close()
os.system('C:/Users/smp/Desktop/SMP/ozerx/stoper.bat')
else:
bot.send_message(message.chat.id, "Ты не Создатель бота; у тебя нет админ-прав, проваливай!")
***
for album_s in albums:
image = ImageTk.PhotoImage(file = str(album_s))
album_button = Button(root,
image = image,
width = 120, height = 120,
command = lambda: print('click'))
album_button.image = image
album_button.pack()
create_albums()
***