|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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... Thanks, erwin |
|
#2
|
||||
|
||||
|
At least you are honest about it
The Browse button is just a button which launches the file or directory dialog. Nothing special ![]() This code... Code:
Tkinter.Button(subframe, text = "Browse", command = self.loadtemplate, width = 10).pack() Code:
def loadtemplate(self):
filename = tkFileDialog.askopenfilename(filetypes = (("Template files", "*.tplate")
,("HTML files", "*.html;*.htm")
,("All files", "*.*") ))
if filename:
try:
self.settings["template"].set(filename)
except:
tkMessageBox.showerror("Open Source File", "Failed to read file \n'%s'"%filename)
return
This should show you the basic idea. grim ![]()
__________________
*** Experimental Python Markup CGI V2 *** |
|
#3
|
|||
|
|||
|
100 % perfect! Thank Grim Archon!
Just what I needed, the more it goes the more I am a fan of python! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Browse button for tkinter |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|