[英]TypeError missing 3 required positional arguments
我有一个tkinter按钮,当按下该按钮时会调用命令“ nadirpatch”。 当我按下按钮时,出现以下错误:
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'
这是我的“ nadirpatch”代码:(变量已经定义)
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
谢谢!
您需要在Button定义中传递参数,如下所示:
# Sample code
button = Tk.Button(master=frame, text='press', command= lambda: nadirpatch(photoSphere, nadir, photospherePath))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.