我正在尝试查找tkinter图像的所有坐标(x1,x2,y1,y2)。当我使用canvas.coords
函数时,它将返回2个坐标。我已经尝试过canvas.bbox
函数,但返回的内容与canvas.coords
相同。一个例子可能是:
from tkinter import *
root = Tk()
root.title('Test')
root.resizable(0, 0)
canvas = Canvas(root, width=500, height=500, bd=0, highlightthickness=0)
canvas.pack()
image = PhotoImage(file='image.png')
id = canvas.create_image(250, 250, anchor='c', image=image)
coords = #coordinate function to get 4 coords
print(coords)
您正在以某种方式更新坐标。当您执行bbox
时,它以某种方式更新为coords
。