0
我目前正在使用Tkinter的交互式GUI,该工具带有BMP图像。实质上,我希望能够点击一个按钮,然后允许用户指定图像上的任意三个点,然后生成最适合的椭圆并返回椭圆内的最小值。带有按钮的Tkinter GUI图像
我能够产生BMP图像,但我不知道如何产生一个按钮w /图像。我会怎么做呢?
点击按钮后,它会执行一个函数,将鼠标光标改为十字准线,然后在图像上点击任意三个点并将它们保存到我将工作的变量中产生椭圆。我希望点击产生一个红点来表示它的位置。
这里是我的代码:
from tkinter import *
from PIL import Image, ImageTk
def bmpGUI():
top=Tk()
top.title("BMP Image")
image = Image.open("ap41.ddr.brf.sdat.bmp")
widthBMP, heightBMP = image.size
tkimage = ImageTk.PhotoImage(image)
w = Canvas(top, width=widthBMP+200, height=heightBMP)
w.create_image((widthBMP/2,heightBMP/2),image=tkimage)
w.pack()
top.mainloop()
return
def main():
bmpGUI()
if __name__ == "__main__":
main()
我加200至宽度,以表明我想排序的交互式工具条的图像旁边。
这有助于很多,谢谢! – FLCL