更新时间:2023-11-25 10:00:16
可能有更好的方法,但这可行.添加一个按钮,并在按下该按钮时从文本输入中获取输入,并将其传递给裁剪功能.
There is probably a nicer way to do it, but this works. Add a button, and when that button is pressed get the input from the text entries and pass them to the crop function.
def crop(self):
self.root = Tk()
self.root.wm_title("Insert Coords")
self.x0 = Entry(self.root)
self.x0.grid()
self.x1 = Entry(self.root)
self.x1.grid()
self.y0 = Entry(self.root)
self.y0.grid()
self.y1 = Entry(self.root)
self.y1.grid()
Button(self.root, text="Crop", command=self.close_crop).grid()
def close_crop(self):
self.crop1(self.x0.get(), self.x1.get(), self.y0.get(), self.y1.get())
self.root.destroy()
def crop1(self, x0, x1, y0, y1):
print x0, x1, y0, y1