We know many modules and one of them is Tkinter. Tkinter is a module which is a standard interface of Python to the Tk GUI toolkit. This interface Tk and the Tkinter modules, both of them are available on most of the Unix platforms. it is also available on Windows OS and many others. But it is usually a shared library or DLL file, for some cases, it is statically linked with the Python interpreter.
Default icon of MessageBox
Whenever we create a message box using the Tkinter, we always see a similar icon in the message box. Let us see it again with an example. Example:
Python3
import tkinter as tkwin = tk.Tk()# as it does not have any mentions # of the icon we get a default icon.win.title("example") win.mainloop() | 
Output : 

import tkinter as to
win = tk.Tk()
win.title("example")
win.iconbitmap(r'')
win.mainloop()
Step 2: Mentioning the file path of the image we want as an icon. Copy the File location and paste it inside “win.iconbitmap(r”)”. 
win.iconbitmap(r'C:\Users\Madhusudan\Downloads\')
Step 3: Mention the file name. Copy the file name and paste it after “\” where you mentioned the file location. 
win.iconbitmap(r'C:\Users\Madhusudan\Downloads\favicon(2).ico')
Finally, we get the complete code for how we can change the icon. Let’s put it together.
Python3
import tkinter as tkwin = tk.Tk()win.title("example")win.iconbitmap(r'C:\Users\Madhusudan\Downloads\favicon(2).ico')win.mainloop()  | 
Output : 
