0

I have been messing around with some scripts, and would soon like to start making a few gui apps. I plan on using either tkinter, or possibly pygame, or pygtk. Are there modules already built that will allow you to browse graphically? for instance, choosing a file, or directory, using a gui button? It would be such a common feature, I would think this is already been done.

3
Contributors
3
Replies
6
Views
12 Years
Discussion Span
Last Post by vegaseat
0

I don't know about directories, but picking files is as easy as implementing a TkFileDialog widget in Tkinter. See Fredrik Lundh's generally excellent (though unfinished) Tkinter tutorial at:

http://www.pythonware.com/library/tkinter/introduction

The bit you're looking for is in the "Dialogs" chapter under "Data Entry."

Tkinter's really easy to use, BTW.

0

Typing
help('FileDialog')
or
help('tkFileDialog')
in the Python shell will bring up the details.
I am still looking for a good example. This is all I have ...

#from Tkinter import *
import tkFileDialog

help('tkFileDialog')

#root = Tk()

filename = tkFileDialog.askopenfilename()

print filename
 
#root.mainloop()

You can uncomment the code. It's there to show you that Tkinter comes up anyway in this simple test.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.