One notable change is the addition of a type of canvas widget, called a
Drawing, that makes use of a knock off of the old Turtle Graphics
plotter control language, along with a button, called a UserButton, that
uses the Turtle Graphics engine to draw its face.
I have included a demo script, stns.tcl, that will poll a web site for
weather reports for US and Canadian cities and display them in a small
window on your desktop. Aside from being useful, if you care about the
weather, it is a good example of the power of both Tcl and the Turtle
Graphics language. The standard Tcl HTTP package is used to grab the
observation data from a web site. Polling is implemented using the
"after" command. A miniscule "regsub" is used to clean the HTML. My
personal favourites, "split" and "regexp" extract all of the raw data.
The Turtle then plots it all in a very nice fashion with a minimum of
programming. This script also demonstrates the power of Fltk container
widgets for geometry management. The entire UI is less than a page long,
including autoscrolled containers, automatic widget state management,
and tooltips. Its heaven compared to doing it in C++, which, by the way,
I did do a couple of years back.
The whole idea for this little exercise originally came from Richard S
with his posting of the Turtle Shell a while back.
If you happen to be a weather enthusiast, you may find the demo
interesting. It displays the current weather for a list of stations
either as a technical plot, or as an icon that resembles the view out of
the window. I use it to avoid the minor hassle of having to fire up a
browser every time I want to know what the temperature is outside. Under
Linux, the script will also create a small database of the observations
it downloads, so you can do research on interstation correlation and
develop your own local weather forecasting system, if you are so
inclined. Under Windows, you will have to develop your own database.
The script maintains a cache of the last 24 hours of observations for a
station. Its also interesting to animate through this list to see how
passing systems change things at your local station.
To aid you in your research, there is also a new widget called XYPlot
that, amazingly, plots data arranged in (x,y) value pairs. This widget
optionally computes a linear correlation model for the plotted points,
and shows the fit and confidence bands for the fit. Now you have
everything you need to compete with the National Weather Service. Should
you become sufficiently skilled that you believe you can outperform
them, please keep it to yourself. Weathermen receive enough abuse from
the public as it is, and over a carreer it could prove psychologically
damaging.
--
Iain B. Findleton
http://pages.infinit.net/cclients
custom...@videotron.ca
(514)457-0744