I'm currently working on a GUI project on Python (3.6) using tkinter (8.6). Following this question I'm wondering how to get back the result of someFunction :
def someFunction(event):
do stuff ..
return(otherStuff)
canvas.bind('<Button-1>',lambda event: someFunction(event))
Thank you in advance :) !
答案 0 :(得分:3)
The return values of callback functions like your someFunction
are ignored. Rather than using return
, have the callback save the value somewhere (in a global variable or an attribute of some kind of object). Or have your function pass the computed value as an argument to some other function that will do something with it.