All variables created in a function are local to that function, i.e are garbage collected when the function exits. So img, photo, var, etc. do not exist outside of the function, which is one of the reasons it is emphasized that classes should be used. Will do my best to come up with modified code later today. Also note that "c" (from Checkbutton) is None as the last function called on the line is grid() and grid() returns None. You then pack() "c" which will produce and error as you can not use both. To keep the Tkinter ID in "c" use 2 lines

This program shows how to use Checkbuttons to change an image using class instance objects which are not garbage collected when the function exits. You can include whatever you want in the callback function. This program changes the image to show that it is working.