2017-05-08 12 views
0

私は、押したときに "nadirpatch"コマンドを呼び出すtkinterボタンを持っています。私はボタンを押すと、私は次のエラーを取得する:TypeErrorがありません3つの必要な定位置引数

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 

ありがとう!

答えて

2

あなたは、以下のようにボタンの定義で引数を渡す必要があります。

# Sample code 
button = Tk.Button(master=frame, text='press', command= lambda: nadirpatch(photoSphere, nadir, photospherePath)) 
関連する問題