embedding filedialog in a frame in tkinter

D

devnew

i am trying out tkinter to make a gui..i want to have a frame with an
embedded file explorer next to a 'open directory' label..i tried out
FileDialog and tkFileDialog methods but they open as pop up dialogs..
how do i make this packed into the frame the way button and other
widgets can be packed? i am a newbie to tkinter..

any help greatly appreciated
TIA
dn
 
G

Gabriel Genellina

i am trying out tkinter to make a gui..i want to have a frame with an
embedded file explorer next to a 'open directory' label..i tried out
FileDialog and tkFileDialog methods but they open as pop up dialogs..
how do i make this packed into the frame the way button and other
widgets can be packed? i am a newbie to tkinter..

Try using Tix, a Tkinter extension included in the Python library. It
provides a DirList widget:

<code>
import Tix

class App:

def __init__(self, master):

frame = Tix.Frame(master)
frame.pack()

dirlist = Tix.DirList(frame, value=r"f:\download\temp",
command=self.showdir)
dirlist.pack(fill="x")

button = Tix.Button(frame, text="Close",
command=frame.quit)
button.pack()

def showdir(self, directory):
print "user selected", directory

root = Tix.Tk()
app = App(root)
root.mainloop()
</code>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,231
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top