python tkinter button set variable to false -
i don't know set variable pressing button in python. example:
done = false ... range_button = button(self.parent, text="start", command=lambda.... ... while done: .....
but don't know how in python, help?
there's nothing special doing tkinter -- if done global variable (or instance variable) set whatever value want. important part is, must non-local variable.
range_button = button(..., command=stop_loop) def stop_root(): global done done = true def something_else(): global done while !done: ...
strictly speaking, don't need global done
statement in function loop, since function isn't changing value of variable. however, think makes intent of code little more evident.
Comments
Post a Comment