Just making a really simple Tcl/Tk program to learn, but I’m having a little trouble.
I need to make a button switch colours when clicked, so it will start red, when clicked it will turn green, and if clicked again will go back to red.
I have got it changing from red to green, but I don’t know how to make it go back the other way.
What is the best way to do this?
It’s not very hard (except on OSX, where this sort of thing is directly against platform UI guidelines) you just need to use a suitable callback:
Consider using a
checkbuttoninstead when you need toggling, as it will be much more rapidly understood by the users.