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.

Recommended Answers

All 3 Replies

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.

thanks, I will check into that :-)

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.