[Tutor] Entry box + browse button

Klas Marteleur klas.martelleur at telia.com
Sat Aug 14 21:19:38 CEST 2004


hmm Alan! I am not sure i understand you correctly . The tkFiledialog module 
workes for me (see screenshot) but i dont know how to combine it with the 
"Entry" box.

i want to have the possibility to Either enter filepath in the box Or browse 
after the file using tkFileDialog. I dont know how to combine the two 
choices.

is it possible to have that choice?

Regards
Klas

lördagen den 14 augusti 2004 18.40 skrev Alan Gauld:
> > 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....
>
> There is no standard file browser dialog - this is a major gap in
> Tkinter, or at least in the Python MegaWidgets (PMW), which is
> where I'd expect to find it...
>
> There are some available on the net, try the Vaults of Parnassus
> as a starting point or this page here as an (untried!) example.
>
> http://home.cfl.rr.com/genecash/tree.html
>
> Alan G.
>
> > #############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: filedialog.jpg
Type: image/jpeg
Size: 19421 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tutor/attachments/20040814/400c217a/filedialog-0001.jpg


More information about the Tutor mailing list