embedding filedialog in a frame in tkinter
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Sat Dec 15 21:17:43 EST 2007
On 15 dic, 04:30, "dev... at gmail.com" <dev... at gmail.com> wrote:
> 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>
--
Gabriel Genellina
More information about the Python-list
mailing list