[Python] How to create tkinter Toplevel that is initially hidden (withdrawn) without flashing?

Discussão em 'Python' iniciado por Stack, Abril 6, 2025.

  1. Stack

    Stack Membro Participativo

    Is it possible to create a Toplevel window in tkinter that is initially withdrawn without flashing. For example:

    import tkinter as tk
    root = tk.Tk()

    def dlg():
    top = tk.Toplevel(root)
    top.withdraw()
    # do more stuff and later deiconify top

    tk.Button(root, text="Dlg", command=dlg).pack()
    root.mainloop()


    Can briefly flash between creation of the Toplevel and the withdraw command. Is there a way to create an initially withdrawn Toplevel?

    Continue reading...

Compartilhe esta Página