Как использовать событие кнопки в Python
import tkinter as tk
root = tk.Tk()
root.geometry("400x400")
frame = tk.Frame()
frame.master.title("UI PNC")
def XL(event):
print("Position:", event.x,event.y)
canvas=tk.Canvas(frame)
canvas.create_rectangle(20,20,200,200,fill="red",tags="UI")
canvas.tag_bind("UI","<Button-3>",XL)
canvas.pack(expand=True, fill="both")
frame.pack(expand=True, fill="both")
root.mainloop()
Cooperative Chinchilla