[Tutor] Entry box + browse button

Klas Marteleur klas.martelleur at telia.com
Sat Aug 14 17:50:53 CEST 2004


Hi again

My very advanced convert program is developing very fast :)

I am now working with my fancy GUI and i would like to have the possibility to 
enter filenames in "Entry boxes" as well as the possibility to browse files. 
See my fancy screenshot attached to this mail :)
I can write a filename in the entry boxes but i dont understand what i need to 
do to get the browse function to work. Here somewere is were i am at at the 
moment....

#############snip############

        self.infile ="/home/klas/Python_filer/Tragic/ebom_from_file_wider.txt"
        self.inputEntry = Entry(master)
        self.inputEntry.insert(INSERT,self.infile)
        self.inputEntry.grid(row=0,column=1)

#############snip############

        self.inputBrowseButton = Button(master, command = self.openFile)
        self.inputBrowseButton.configure(text = "Browse")
        self.inputBrowseButton.grid(row=0,column=2)

#############snip############

    def openFile(self):
        import tkFileDialog
        self.infile=tkFileDialog.askopenfilename()

#############snip############

First i thought that if i just changed the value "self.infile" in the "def 
openFile" function that the entry would change. But i realize now that is not 
that easy..... I am thinking.... bind.... hmmmm??

Could some nice person guide me in the right direction :)

Thanks
Klas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Convert.jpg
Type: image/jpeg
Size: 14301 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tutor/attachments/20040814/79c68560/Convert-0001.jpg


More information about the Tutor mailing list