[Tutor] Re: from prompt to file in windows

Kirby Urner urnerk@qwest.net
Tue, 4 Sep 2001 08:37:00 -0400


Yes Kumud, on Windows the best shell for Python straight out
of the download is IDLE, a graphical shell.  You go File | New Window
and write your Python code there.  Then Save.  Then, back at 
the shell window, go 'import mynewmodule' (no quotes) and 
your new code will either (a) be imported or (b) give you some 
error messages.  Or you can Save and go Ctrl-F5 and have 
your program execute right there and then.

When writing for import (i.e. internal use), vs. exporting a script, 
you'll develop a slightly different psychology.  You'll invoke 
individual classes and functions that you've written as tools, 
maybe gluing them together in short ad hoc functions you actually 
write in the IDLE shell window (easily done).  These ad hoc 
functions, if used often, might eventually be worth migrating to
the module itself (just cut and paste).

IDLE has limitations in that Tkinter programs, when quit, often
make the whole of IDLE quit, because it's a Tkinter program 
and doesn't run your stuff as a separate process.  The VPython
modifications to IDLE seem to get around this, and the IDLE fork
project might eventually get around this problem as well.  You
can still write Tk programs in IDLE, but boot/test them in a 
DOS Python shell open in another window.

In any case, for non-Tkinter programming, I highly recommend
IDLE over using any DOS box shell.  Your program is automatically
color coded and so forth.  You can get other editors that do this, 
but IDLE is more than an editor, it's a shell, so you can execute 
an expression directly, as you would in the DOS shell.

Note:  all of the above applies to Linux as well.  You have the
option of installing IDLE from /Tools after you compile a new version,
simply by copying it to the apppropriate subdirectory (e.g. to 
/usr/lib/python2.0/site-packages/idle/idle.py or maybe to
/usr/local/lib/python2.2/site-packages/idle/idle.py).  

Chances are, if you're a long-time *nixer, you've picked up 
Vi or Emacs or something (Windows versions of these also available), 
and you might frown on IDLE's program editor (you might not though
-- not everyone is that fanatical about their text editor).  On other 
hand, if you're new to both Python *and* Linux, then using IDLE, 
over trying to master a new editor (and/or typing everything in 
some Xterm window running Python in shell mode) will probably
give you more immediate satisfaction.

Kirby

On Tuesday 04 September 2001 03:24, lonetwin wrote:
> Hi all,
>     Maybe someone could help kumud ....
>
> --- kumud  joseph <kumudjk@rediffmail.com> wrote:
> >   hi steve,
> >      its me kumud again . i've done few things in
> > python such as basic programming , little bit of
> > visual python,tkinter , and some of the numpy...but
> > my basic problem is that i m not able to save any of
> > my programmes through the python prompt used in
> > windows .. so do help me ...
> >  ---kumud