[Tutor] Re: [Python-Help] RE...Two Questions.........from PRJoshi

Alex Martelli aleaxit@yahoo.com
Thu, 27 Dec 2001 14:54:22 +0100

"Pravin Raj Joshi" <prjoshi@ntc.net.np> writes:
> 1. I am currently using the latest realese of Python(Python 2.2). It does
> not support the import command for my script i.e. when I divide my program
> into a series of classes and keep each class in a new page, I cannot
> the pages to other pages. I get a message which says that module is not
> found. I had the same problem with Python 2.2 beta. Can anyone tell me
> am I doing wrong.

Not sure what you mean by "pages", but, anyway, the issue is most likely
that you're placing your whatever.py files in directories that are not
amongst those listed in sys.path.  When one of your modules does
    import whatever
then file whatever.py must be on one of sys.path's directories.  Fix
this either by moving your files to the appropriate directories, ones
that are already on sys.path, or by adding the directories you want to
use to sys.path.  For the latter's purposes, you have many possible
approaches, depending on what control, in detail, you have about your

> 2. I want to change the icon of my Tkinter program window. I read
> that the icon in a root window cannot be changed. So I changed all my
> windows to a Toplevel window and still I cannot change the icons. I copied
> the code that is available for tkSimpleDialog (root/python/lib/lib-tk) and
> tried and still it does not work. But the code works in the
> SimpleDialog(changes icon to whatever is written in the title).

You're saying that SimpleDialog, copied IDENTICALLY, works or fails
to work for you depending on what directory you put it in?  Maybe it's
again a sys.path problem.  But I didn't think SimpleDialog had a
function to change its icon...?  Maybe I haven't looked at it recently
enough.  Anyway, you're not meant to COPY SimpleDialog, and you don't
have to: the best way to reuse its code is to INHERIT from it.

Please keep discussion on both issues on python-help@python.org, NOT
on my personal mailbox, so other volunteer helpers get a chance to
see and help, thanks.