/
spirzen
/
it-code-examples
Обзор
Документация
Войти
/
spirzen
/
it-code-examples
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/python/py-502-311-011/main.py
22 строки
478 B
Spirzen
Code migration pack
09 июн 2026, 01:41
09 июн 2026, 01:41
cebc284
Код
Авторство
О чём код?
import tkinter as tk def switch_image(): global current_img if current_img == photo1: label.config(image=photo2) current_img = photo2 else: label.config(image=photo1) current_img = photo1 root = tk.Tk() photo1 = tk.PhotoImage(file="img1.gif") photo2 = tk.PhotoImage(file="img2.gif") current_img = photo1 label = tk.Label(root, image=photo1) label.pack(pady=20) label.bind("<Button-1>", lambda e: switch_image()) root.mainloop()