The argument to bind
must be a reference to a function. When you do something like:
...bind('<Return>', self.makeRawProbe(byteColumn+(16*byteRow)))
... then you are actually calling self.makeRawProbe(...)
, and the result of that call is what is being assigned to the binding.
Instead, you need to pass a reference to the function itself. Since you need to pass arguments to the function you will need to use something like lambda
or functools.partial
or a factory of some sort. I'm partial to lambda
since it doesn't requiring pulling in another library.
For example:
value = byteColumn+(16*byteRow)
...bind('<Return>', lambda event, idx=value: self.makeRawProbe(idx))