Python Questions - July 25, 2015

Laura Creighton lac at openend.se
Sat Jul 25 15:30:53 CEST 2015


I can answer some of these.

In a message of Sat, 25 Jul 2015 04:39:43 -0500, "E.D.G." writes:
>       At the moment our Perl programs use Windows "Pipes" plus files in an 
>interactive mode to send data to Gnuplot so that the data can be plotted. 
>That actually produces good results.  But it is a complex and inefficient 
>process.  So part of the conversion process involves learning how to have 
>Python or some other program plot data in the same interactive mode.

check out
matplotlib http://matplotlib.org/
mayavi http://docs.enthought.com/mayavi/mayavi/
bokeh http://bokeh.pydata.org/en/latest/
seaborn: http://stanford.edu/~mwaskom/software/seaborn/

There are others.
It sounds to me as if bokeh or mayavi animations are what you will
be most interested in, but we can discuss this more.

>1. The initial version of Python being used has to be a free download that 
>is easy to understand.  And it has to be compatible with Windows.
>
>       Where can the best free download version of Python be obtained?
>
>       Is the ActiveState version the best one for people who are not Python 
>experts?

For you, I think not.  Your use case sounds like you are seriously on
the 'scientific python' end of things.  So you would be most interested
in installing either the Enthought Scientific Python Collection (Canopy)
https://store.enthought.com/

Or the Anaconda Scientific Python Suite:
https://store.continuum.io/cshop/anaconda/

Enthought has been the leader in Scientific Python for many, many years.
Anaconda is the new kid on the block.  I cannot state which is better --
Anaconda is what we are using here at Chalmers University for the most
part.

They both duplicate the same functionality, for the most part, but
the conda package manager that comes with Anaconda is really terrific.

They bundle in all sorts of graphics and visualisation things.  This
is where you should start your looking.

>2.  Graphics - This is likely a fairly complicated question.
>
>       What are some of the graphics options available with Python?

see Anaconda and Enthought for a good start.  If they don't do what
you want, come back and discuss this more, we have plenty more
options.

>3.  Fast Calculations
>
>       It is my expectation that Python by itself does not do calculations 
>very fast when compared to a language such as Fortran.

For the C version of Python, yes.  There are many options for speeding
up your python, but for your purposes numpy -- which is integrated into
both the Enthought and Anaconda distribuitions is likely to be the
most useful.  You can also integrate with Fortran libraries should
you want to here.

>4. What is the code for opening a Windows "Pipe" between a running Python 
>program and some other program such as another Python or Perl program that 
>can work with pipes?

No, clue, I don't know very much at all about Windows.

>5. We would want Python to check for a key press now and then without 
>actually waiting until a key is pressed.  What would be the command for 
>that?  It is likely something like Get_Key

Python knows _nothing_ about keys, keyboard input and the like.
Capturing that stuff is the function of the graphical user interface
program you use.  Python has many of these.  They all do it slightly
differently but you won't have any problems whatever one you pick.

>6. What is Python's version of the DOS level "System" command that many 
>programs use as in:
>
>system "open notepad.exe"

Again, not a windows person but I am pretty sure you are looking for the
subprocess module:

For Python 2
https://docs.python.org/2/library/subprocess.html#module-subprocess
For Python 3
https://docs.python.org/3.5/library/subprocess.html#module-subprocess

>7. What is Python's version of the SendKey command that many programs use to 
>send information to an active Windows program as in:
>
>SendKey("Message to be printed on the Notepad screen")
>
>or
>
>SendKey(Right Arrow Key)

We don't have one.  You have to talk to your GUI toolkit for this.

>8. What commands does Python use to send to, and retrieve information from, 
>the Windows clipboard?

I don't know, again, I  think you have to talk to your GUI toolkit.

So, if I were you I would go check out the Enthought and Anaconda links
and see if you like what they have to offer.  What Gui toolkit you should
use is partly a matter of personal preference, but often a matter of
what kit works best with whatever visualisation tool you choose.

In terms of the talking to people who heavily use the graphics toolkits
mentioned, well, this list isn't a bad place to look for people but
The scientific Python mailing list may get be a better place.

http://www.scipy.org/scipylib/mailing-lists.html

Anaconda also has a google group
https://groups.google.com/a/continuum.io/forum/#!forum/anaconda

And, of course, the various visualisers have their own mailing lists
and forums which may be of use.

Hope this helps,
come back with any more questions
Laura Creighton


More information about the Python-list mailing list