I am so new to python. I am trying to implement a program which changes a button's image property with an "on click" operation. I have tried png, jpeg, gif and bmp formats. I don't want to use PIL, I just want to handle it with tkinter. When I click on the button a small square appears on button but there is no actual image that can be seen. I have tried many things, search StackOverflow and the Internet, and couldn't come up with a solution. Is the problem caused by the version problem or something? My code is below, thank you so much for your support:
from tkinter import *
def insertRedDisc(buttonParam):
image = PhotoImage(file=r"C:\Connect4\red.png")
buttonParam['image'] = image
window = Tk()
window.title("Button State App")
window.geometry('1000x1000')
window['bg'] = "blue"
for i in range(6):
for j in range(7):
frame = Frame(master=window, relief=FLAT, borderwidth=5, bg="blue")
frame.grid(row=i, column=j, padx=1, pady=1)
myButton = Button(master=frame, width=5, height=5)
myButton['command'] = lambda theButton=myButton: insertRedDisc(theButton)
myButton.pack()
window.mainloop()