I would like to replace the default python tkinter icon for both a top level window and a child window. I've tried several things that cause errors. What is the best way to replace the icons for both parent and child windows? See my attempts below - I'm using python 3.9.1
import tkinter as tk
from PIL import Image, ImageTk
m = tk.Tk()
m.title('Main Window')
m.geometry('300x100')
blankImageObject = tk.PhotoImage(file='icons/blankIcon.png')
m.tk.call('wm', 'iconphoto', m._w, blankImageObject)
c = tk.Tk('m')
c.title('Child Window')
c.geometry('300x100')
#try to re-use the same image object created for the main window
#c.tk.call('wm', 'iconphoto', c._w, blankImageObject)
#try creating a new PhotoImage object
#c.tk.call('wm', 'iconphoto', c._w, tk.PhotoImage(file='icons/blankIcon.png'))
#try using main window instead of the child window in the Tcl call
#c.tk.call('wm', 'iconphoto', m._w, tk.PhotoImage(file='icons/blankIcon.png'))
#try using main window in the Tcl call and the blankImageObject from the main window
#c.tk.call('wm', 'iconphoto', m._w, blankImageObject)
m.mainloop()