For entertainment purposes only.
popup.add_command(label="Allow Moving Item",
command=lambda: globals().update(allowMoving=True))
(Although globals()
is not documented with the same "do not modify the return value" warning as locals()
, I'm still not sure this is guaranteed to work.)
A better answer would be to define the callback with a def
statement instead.
def set_allow_moving():
global allow_moving # Don't use camel case for variable names in Python
allow_moving = True
popup.add_command(label="Allow Moving Item", command=set_allow_moving)