Oct-21-2021, 04:32 PM
Using global is not a good way to fix it
If you don't want to use classes which is a better way of organising GUI code where you could keep a reference to the image as an attribute of the class instance, you could do the following.
Also see Namespace flooding with * imports
If you don't want to use classes which is a better way of organising GUI code where you could keep a reference to the image as an attribute of the class instance, you could do the following.
deposit_exit_button_photo = PhotoImage(file = r"Z:\Finley\School\Sixth Form\School Images\CS\exit.png") deposit_exit_button = Button(deposit_page, text="", image = deposit_exit_button_photo, command = exit_menu) deposit_exit_button.image = deposit_exit_button_photoTo keep a reference to it on the button object.
Also see Namespace flooding with * imports