[Tutor] Re: Starting with Python

Andrei project5 at redrival.net
Mon Nov 24 07:46:52 EST 2003


the_investor wrote on Mon, 24 Nov 2003 00:24:14 -0800 (PST):

Hi,
<snip>
> I want to take the next big leap by giving myself a *difficult* assignment 
> on changing a simple spreadsheet that I created many moons ago and forming 
> it into a Python program.
> 
> Unfortunately there is a heap of stuff out there and someone like me can 
> get caught up chasing their tail just in finding a suitable IDE!

For minimal fuss: SciTE (http://scintilla.org) or the PythonWin IDE if
you're on Windows (get the ActiveState Python distro because it includes
PythonWin and very good docs (http://activestate.com/Products/ActivePython/
and click on the big red Download button in the upper left part of the
screen).

> Let's say, for now, I wish to create a simple line chart from a static 
> table plotting X & Y values (something which is simple for me to do in 
> Excel)... 

For this kind of really simple stuff, nothing beats spreadsheets, even if
it were just for the overhead of typing commas en parentheses in Python
which you don't have to do in a spreadsheet - right tool for the right job
and all that. That being said, if we're talking about data you don't type
in yourself and the graph is part of a larger application which does other
processing too, you should look into one of the plotting packages. 

> where best to dive into (databases? wx?...)?

Start small, no databases -Python data structures are sufficient- and no
wxPy. Learn Python basics with one of the tutorials
(http://www.python.org/topics/learn/non-prog.html) - it's an easy language
to pick up. Given your example, I'd first learn to implement the
mathematical part of a spreadsheet in Python and only then worry about
plotting the results.

Once you know how things work in Python, go and try the plotting packages.
The ones I know of are wxPyPlot
(http://www.cyberus.ca/~g_will/wxPython/wxpyplot.html), Chaco
(http://www.scipy.org/site_content/chaco/intro) and Gnuplot from SciPy
(http://www.scipy.org/site_content/tutorials/plot_tutorial). Gnuplot would
be a good starting point I think if you don't want to get into GUI stuff,
it's easier than learning wxPython.

> Or have I totally dove into the deep end!

Plotting with Python is not as easy as it is with a spreadsheet because the
to a spreadsheet plotting is a primary function - a few clicks and you've
got a plot, but to Python it isn't. Not that it's hard to do, but it
requires more manual work initially.

Oh, almost forgot: there's a Python shell called Psi which *does* have some
built-in plotting abilities. Perhaps it's a good way to learn Python and do
plotting at the same time. You can find it here:
http://www.chez.com/spinecho/pypsi/pagpypsi.htm.

-- 
Yours,

Andrei

=====
Mail address in header catches spam. Real contact info (decode with rot13):
cebwrpg5 at jnanqbb.ay. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V ernq
gur yvfg, fb gurer'f ab arrq gb PP.




More information about the Tutor mailing list