# -*- coding: utf8 -*-
from tkinter import*
import tkinter.ttk as ttk
def teget():
global Toc_entry
global btn2
btn2.destroy()
btn2 = Button(root, text = Toc_entry.get())
#btn2.bind('<Button-1>', ???)
btn2.pack()
global children
children.destroy()
def Table_of_contents(event):
global children
children = Toplevel(root)
children.title("Оглавление")
global Toc_entry
Toc_entry = Entry(children)
Toc_entry.pack()
Toc_e_btn = Button(children, text = "Принять", command=teget)
Toc_e_btn.pack()
root = Tk()
root.title("Титульный лист")
#root.state('zoomed')
btn1 = Button(root, text = "Оглавление")
btn1.bind('<Button-1>', Table_of_contents)
btn1.pack()
global btn2
btn2 = Button(root, text = "Исполнитель")
#btn2.bind('<Button-1>', ???)
btn2.pack()
root.mainloop()
# -*- coding: utf8 -*-
from tkinter import *
import tkinter.ttk as ttk
from PIL import Image, ImageTk
root = Tk()
root.title("LH")
c = Canvas(root, width=500, height=500)
c.pack()
event = 123
imag1 = 0
imag2 = 0
def p1(event):
c.delete(imag2)
image1 = Image.open("C://1.png")
photo1 = ImageTk.PhotoImage(image1)
c.image = photo1
imag1 = c.create_image(200, 250, image=photo1)
c.tag_bind(imag1, '<Button-1>', p2)
def p2(event):
c.delete(imag1)
image2 = Image.open("C://2.png")
photo2 = ImageTk.PhotoImage(image2)
c.image = photo2
imag2 = c.create_image(200, 250, image=photo2)
c.tag_bind(imag2, '<Button-1>', p1)
p1(event)
root.mainloop()
@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)