Perl/Tk saves your favourite tools

Main
back: Atsar encap -1
next: Creating Tk-widgets

(source) The first data line which is produced by atsar describes the meaning of the columns, with two exceptions: the first column is the start-time (renamed to 'time') and the last column contains the data-type. We already know what the data-type is because we specified that as option on the command-line when atsar was started, so we throw that information away.

For each of the columns, we create a label to show the value related to that column. Of course, you have to create a explanatory label with the name of the field for the user too, but for the simplicity of the slide, I left that one out.

In the above program, the order of the column(-labels) is kept in @f, and used to refill the hash with actual measured values on the moment the next line of output from atsar arrives.
The magic of Tk had caused a label to be tied to the hash-values: so with us changing the values, the screen gets automatically updated!

Yes: this is all we need to create an interface as shown above... the main window and one of its sub-windows are shown. Compare it to the source to get the final touch.


 
Atsar encap -1 Creating Tk-widgets

Created by Mark Overmeer with PPresenter on 5 august 2001.