[Tutor] Entry box + browse button

Alan Gauld alan.gauld at blueyonder.co.uk
Sat Aug 14 18:40:31 CEST 2004


> 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



More information about the Tutor mailing list