[Tutor] Help - Doubt of Listbox
Danny Yoo
dyoo@hkn.eecs.berkeley.edu
Tue, 2 Oct 2001 00:12:22 -0700 (PDT)
On Mon, 1 Oct 2001, Glauco Silva wrote:
> Hi men , I'm new member of this list and i have a doubt of programing
> in Python :
Hello! By the way: it's not just men in here; we welcome all genders,
nationalities, carbon-based and non-carbon-based lifeforms to
Tutor. Welcome aboard!
> - I would like to know how i can mount two listbox and put Directories
> in the first one and files of the directories in the second listbox .
We can create a Frame() that will house those two listboxes:
###
>>> frame = Frame(root)
>>> frame.pack()
###
Not too exciting yet, since there's nothing in the frames yet. Let's add
two listboxes to that frame:
###
>>> dir_listbox = Listbox(frame)
>>> files_listbox = Listbox(frame)
>>> dir_listbox.pack()
>>> files_listbox.pack()
###
By this time, we should have two listboxes on-screen. That takes care of
much of the GUI side of things. Now all we need to do is add things into
those Listboxes. There are a few functions in the 'os' module that might
be useful, as well as the 'glob' module. You can find out about both on
the Library Documentation site of Python.org:
http://python.org/doc/lib
One thing that should be added: it sounds like you're writing a file
browser of some kind. If so, you might want to see if someone has done
this already, as it's quite a bit of work. There are collections of
widgets from the Python Megeawidgets project:
http://pmw.sourceforge.net
Anyway, hope this helps. What other questions do you have? If you have
more questions, please feel free to ask the list.