from tkinter import *
def hide_show1():
if result.get():
label.config(image=img2)
else:
label.config(image=img1)
text.delete(1.0, END)
text.insert(1.0, "Париж - місто любові і мрія, в яку неможливо не закохатися")
def hide_show2():
if result.get():
label.config(image=img4)
else:
label.config(image=img3)
text.delete(1.0, END)
text.insert(1.0, "Лондон - одне з найбільш багатогранних міст у світі, яке увібрало в себе не тільки традиції Британії")
def hide_show3():
if result.get():
label.config(image=img6)
else:
label.config(image=img5)
text.delete(1.0, END)
text.insert(1.0, "Берлін - місто свободи, культури та історії")
root = Tk()
root.geometry('800x400')
root.title("Столиці")
# Загрузка изображений
img1 = PhotoImage(file='paris.png')
img2 = PhotoImage(file='paris2.png')
img3 = PhotoImage(file='london.png')
img4 = PhotoImage(file='london2.png')
img5 = PhotoImage(file='berlin.png')
img6 = PhotoImage(file='berlin2.png')
# Начальное изображение
label = Label(root, image=img1)
label.place(x=200, y=20)
# Текстовое поле
text = Text(root, width=40, height=10, wrap=WORD)
text.place(x=400, y=20)
# Кнопки
btn1 = Button(root, text="Париж", width=10, command=hide_show1)
btn1.place(x=50, y=50)
btn2 = Button(root, text="Лондон", width=10, command=hide_show2)
btn2.place(x=50, y=100)
btn3 = Button(root, text="Берлін", width=10, command=hide_show3)
btn3.place(x=50, y=150)
# Переключатель
result = IntVar()
praporets = Checkbutton(root, text="Нічні фото", variable=result, onvalue=1, offvalue=0)
praporets.place(x=50, y=200)
root.mainloop()