Marco's Blog

All content personal opinions or work.
en eo

Weight Table - TCL

2005-03-15 2 min read Uncategorised marco

Weight – The Tcl Version

Ok, the real name of the program is gewicht.tcl, and it is correctly TCL, since it’s an acronym. Now that we’ve got the FAQ done, let’s move on to greater things…

The only external package used is TkTable. The weight input is a table, so that you can see past dates and modify the data there, or even input many days at the same time. If TkTable is not available, don’t despair – you’ll still be able to input today’s weight (but not the bodyfat) very conveniently.

All you need to run the program is Tcl, more precisely a currentish Tcl/Tk wish application. gewicht.tcl expects the file gewicht.txt to be present in the startup directory. It will read the file and figure out the current weight chart from there, asking for additional data if there is no information for the current day.

The format of the file is fairly simple. In human-readable terms it’s a sequence of lines, each of which contains the data for one particular day. Each day is made up of the date, the weight, the bodyfat percentage and a comment, each separated by semicolons.

Example: 16.03.2003;170.4;20.1;Back from Maui

Of course I didn’t choose the example to rub it in! 🙂

Everything after the weight is optional. The code knows how to work around missing data, and it doesn’t expect the dates to be sequential.

Once input is complete, a chart pops up. Dots mean single day data, lines denote averages. Big black dots mean data with comments, and if you hover above the dot, a popup will show the comment. An unruly status display at the bottom will show the current pointer pixel’s date and weight.

By default, it shows dates on the x-axis and weight in pounds on the y-axis. A ‘complicated’ system of keyboard shortcuts allows you to get to additional data:

  • l for ‘lbs’, displays the weight in pounds
  • k for ‘kilos’, displays the weight in kilograms
  • b for ‘bodyfat’, displays weight and bodyfat (y axis displays bodyfat units)
  • f for ‘fat’, displays weight and total fat (y axis displays pounds)
  • t for ‘total’, displays weight and non-fat total (y axis displays pounds)
  • q for ‘quit’
  • right, left, control right, control left, home, end navigate if you need to scroll
  • alt f, shift alt f save the current canvas as postscript file