[Tutor] 2 questions......novice but not beginner

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Tue Sep 27 09:15:31 CEST 2005



On Mon, 26 Sep 2005, Mike Pippin wrote:

> I need to know how to allow the user to search their local drives and
> directories in order to load a file...or if there are any pre-written
> opensource functions that will also be well appreciated.. Second....

Hi Mike,

This is not completely obvious to do efficiently: that's what tools like
Google Desktop, Apple's Spotlight, and Microsoft's WinFS are trying to
enable.  If you can tell us what operating system you' re using, we might
be able to point you toward something.

If efficiency doesn't matter, you can brute force a search with os.walk:

    http://www.python.org/doc/lib/os-file-dir.html#l2h-1628

However, it's preferable not to use this as a general-purpose searching
utility, as it's very expensive to walk across a system's directory tree
structure like this: that's why using something OS specific might be a
good idea here.  If you're on Unix, you might even want to take advantage
of something like 'locate' or 'glimpse', which can maintain a quick
searchable index of your computer's files.

Can you limit the scope of the search somehow to a particular set of
directories, or do you have to search your whole hard drive?



> I need to know how to render graphics without the windowed
> enviroment.....I know with pygame you can have a windowless enviroment
> but I need to be able to have only the graphics i choose displayed on
> the screen without pygame filling the rest of the screen with black if
> thats possible.

Out of curiosity, why?  I don't know offhand how to do this, but the
pygame folks might: have you asked them yet?

Could you just capture the screen first, start up pygame, and then draw
the screen-captured image there?  That could provide an illusion of having
the game run on top of the desktop environment.  It's cheap, but it might
work.  *grin*



More information about the Tutor mailing list