June 22nd, 2004, 12:47 PM
Browse button for tkinter
Hello, I would like to add a browse button to one of my graphical interfaces, but lazy as I am I don't really want to program myself a browse button (you know the kind of button you use to open a file somewhere in your hard disk, if of course you are not a linux professional and open all your files with the terminal...)
Is there such a button already built in Tkinter or do you know somewhere to find it, i did a little research and it doesn't seem that common...
June 23rd, 2004, 06:13 AM
At least you are honest about it
The Browse button is just a button which launches the file or directory dialog. Nothing special
Tkinter.Button(subframe, text = "Browse", command = self.loadtemplate, width = 10).pack()
This should show you the basic idea.
filename = tkFileDialog.askopenfilename(filetypes = (("Template files", "*.tplate")
,("HTML files", "*.html;*.htm")
,("All files", "*.*") ))
tkMessageBox.showerror("Open Source File", "Failed to read file \n'%s'"%filename)
June 23rd, 2004, 10:01 AM
100 % perfect! Thank Grim Archon!
Just what I needed, the more it goes the more I am a fan of python!