I have a tkinter button invoking the command "nadirpatch" when pressed. When I press the button, I get the following error:
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'
Here is my code for "nadirpatch": (the variables have already been defined)
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
Thanks!
You need to pass arguments in the Button definition as shown below:
# Sample code
button = Tk.Button(master=frame, text='press', command= lambda: nadirpatch(photoSphere, nadir, photospherePath))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.