我有一个tkinter按钮,当按下命令“nadir修补程序”时调用它。当我按下按钮时,会得到以下错误:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py", line 1699, in __call__
return self.func(*args)
TypeError: nadirpatch() missing 3 required positional arguments: 'photoSphere', 'nadir', and 'photospherePath'下面是我为“nadir修补程序”编写的代码:(已经定义了变量)
def nadirpatch(photoSphere, nadir, photospherePath):
for photospherePath in photospherePath:
photoSphere = Image.open(photospherePath)
nadir = Image.open(nadirPath)
nadir = nadir.resize((photoSphere.size), resample=0)
photoSphere.paste(nadir, (0, 0), nadir)
photoSphere.save((stitchedPath+"/patchedsphere"+(str(fileNum+1))+".jpeg"), "JPEG")
fileNum +=1谢谢!
发布于 2017-05-08 14:51:43
您需要在Button定义中传递参数,如下所示:
# Sample code
button = Tk.Button(master=frame, text='press', command= lambda: nadirpatch(photoSphere, nadir, photospherePath))https://stackoverflow.com/questions/43850351
复制相似问题