How to hide Tk root window when using only canned dialogs?

Paul Soper soperpd at yahoo.com
Wed Feb 20 09:42:56 EST 2002


The example script below works fine but the Tk window is visible
throughout.  Is there a way to make it invisible?

import shutil
import sys
import tkMessageBox
import tkFileDialog

infn = tkFileDialog.askopenfilename()
if not infn:
    tkMessageBox.showerror("No input file", "No input file given")
    sys.exit()
outfn = tkFileDialog.asksaveasfilename()
if not outfn:
    tkMessageBox.showerror("No output file", "No output file given")
    sys.exit()    
shutil.copyfile(infn, outfn)
tkMessageBox.showinfo("File Copy Complete", "%s\ncopied to\n%s" %
(infn, outfn))



More information about the Python-list mailing list