making a web page with interactive figures

Alex Martelli aleaxit at yahoo.com
Wed May 16 07:04:18 EDT 2001


"tla" <nospam at newsranger.com> wrote in message
news:jdjM6.3039$6j3.283250 at www.newsranger.com...
>
> I would like to venture into making a Web Page with interactive figures,
but
> have never done any web programming and no idea which tools to use.  I've
been
> using Python for a few years (mostly numeric stuff -- data analysis and
> acquisition, etc.), and would like to stick with Python if possible.
Could
> someone tell me if I can do the following things on a web page using
Python and
> which tools would be appropriate.
>
> 1)  Display two graphs, and when the user selects (clicks on) a point in
one
> graph, have the other graph refresh with a new picture based on the
selected
> point.

This can be done in pure HTML, no programming required.  The <MAP> and
<AREA> tags of HTML allow this directly.  See for example
http://www.kasparius.com/nonflash/tutorial/tut1.htm for a tutorial
on HTML image maps.  There are many free and commercial tools to
help you define HTML image maps.


> 2) (I think this is harder than #1.)  Given two simple figures, A and B,
each
> composed of just few arrows and boxes, etc. , I would like to allow the
user to
> grab (click and hold) an object in A, and move it around smoothly, and
while
> this is being done, smoothly update the objects in B, in some
predetermined way,
> depending on what's happening in A.

You're quite right about it being harder -- there is no support for
this in HTML, so we're jumping from a trivial no-programming-required
task [1] to one that just can't be done without installing some kind
of program on the user's computer.  An applet running on the JVM has
deployment advantages -- your user won't even notice it is being
"installed", apart from possible transmission delays.  In theory you
can write applets in Jython, but that may be a practical problem: it
requires the user to have a VERY up-to-date JVM (most browsers have
old and outdated JVM's), AND it adds 200K or so to the applet size.
So, in practice, if you decide to go for an applet solution, it had
better be coded in Java.


> 3)  For any state in #1 and #2, generate a stereo sound file from two
NumPy
> arrays and allow the user to listen to this.
>
> I assume, especially, for 2, but possibly for 1 and 3, that the user will
need
> to have an executable that automatically runs on their computer.  Is this
the

Definitely, for [2].  The applet advantage is that the executable (the
JVM) is likely to be already installed, and you "only" need to supply
a "little" bit of extra code (your applet's .class file).

Installing your own programs on the user's computer runs into several
practical problems -- WHAT kind of hardware and operating system is
your user running?  If you can limit that (e.g., "some kind of
Windows box"), then it's not too bad (and you can program it in
Python pretty easily) -- unless you want that executable to interact
with the user's browser, then once more you have to wonder WHAT kind
of browser it is (unless, again, you can limit that, e.g. "Internet
Explorer 5.5 or later" -- then it's easy again, but you have cut off
all Linux users, all Netscape fans, all Opera ones, ...).  Your user's
JVM implicitly interacts with his chosen browser, so deployment is
easier -- if you code your applet in Java.

Sound support for JVM's is uneven across browsers, I believe, so
once again you may have deployment trouble whatever language you
choose to code in.


Alex






More information about the Python-list mailing list