[Tutor] Help - Doubt of Listbox (fwd)

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Tue, 2 Oct 2001 10:32:15 -0700 (PDT)


Dear Glauco,

Hello again!  I'm somewhat unable to answer your question at the moment (I
still have this project due Thursday.  After Thursday, I should be ok.)

It's usually better to send messages to the tutor list, so that you can
get other people to look at your questions.  I'll forward your question to
the list.  Again, my apologies!


---------- Forwarded message ----------
Date: Tue, 2 Oct 2001 09:35:53 -0300
From: Glauco Silva <gbcs1978@hotmail.com>
To: Danny Yoo <dyoo@hkn.eecs.berkeley.edu>
Subject: Re: [Tutor] Help - Doubt of Listbox


I would like to know if have any module that put directories or files in one
listbox for exemple .
If you have , i would like to know if you can past to me .

Thank you !
Glauco

----- Original Message -----
From: Danny Yoo <dyoo@hkn.eecs.berkeley.edu>
To: Glauco Silva <gbcs1978@hotmail.com>
Cc: <Tutor@python.org>
Sent: Tuesday, October 02, 2001 4:12 AM
Subject: Re: [Tutor] Help - Doubt of Listbox


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.