任何人都有一個想法,爲什麼下面的代碼會產生錯誤?從func返回2個值
我叫FUNC獲得鼠標座標:
def button_click(event):
x, y = event.x, event.y
print('{}, {}'.format(x, y))
return x, y
,然後我要分配的結果,新的變量在主:
x_cord, y_cord = app_root.bind('<ButtonRelease-1>', button_click)
通過這樣做,我得到以下錯誤:
"x_cord, y_cord = app_root.bind('<ButtonRelease-1>', button_click)
ValueError: too many values to unpack"
任何人都有一個想法,爲什麼發生這種情況?謝謝大家!
你沒有縮進? – putvande
'app_root.bind'返回什麼? – max
你能提供完整的堆棧跟蹤嗎? –