Search code examples
pythontkintersimpledialog

How do I change the icon of a simple dialog in tkinter, Python


Not sure how to change the icon of a simple dialog window. I try to use .bitmap but doesn't work. Need Help


Solution

  • Just add the default keyword argument to the iconbitmap() for the icon of the root, then all the child windows will inherit the icon.

    import tkinter
    from tkinter import simpledialog
    
    root = tkinter.Tk()
    root.iconbitmap(default="C:\\Users\\username\\random.ico")
    
    dialog = simpledialog.askstring("INFO", "wut ur name?")
    
    root.mainloop()
    

    Result with default:

    Results without default: