[Tutor] Entry box + browse button SOLVED

Klas Marteleur klas.martelleur at telia.com
Sun Aug 15 00:17:58 CEST 2004

Hi again

Actually i wasnt that far from the solution as i was thinking. The thing was 
to delete the text in the box before trying to add a new one (otherwise the 
new filename gets appended after the default one.

This is what i did: I added two functions. One to call from the 
"inputBrowseButton" function and one to call from the "outputBrowseButton" 

    def openInFile(self):
        import tkFileDialog
        infile = tkFileDialog.askopenfilename()
        self.inputEntry.delete(0,END) # Clean the default Entry

    def saveAsFile(self):
        import tkFileDialog
        outfile = tkFileDialog.asksaveasfilename()
        self.outputEntry.delete(0,END) # Clean the default Entry
        self.outputEntry.insert(INSERT, outfile)


More information about the Tutor mailing list