| Andreas Rozek |
|
TkLua ChimeLike Clock, the Chime example is among the first Lua programs used to test the proper (and continuous) function of the author's TkLua distribution for Win32 platforms. The program offers a digital time display in addition to a chime (on every hour or half hour) with "prewarn function". If desired, the chime produces an audible alarm (which helps the author not to waste too much time browsing the web).
Technical DescriptionThe digital time display forms the primary part of the graphical user interface - a Checkbutton reflects the current audible alarm setting and a status line informs about the time left to the next warning (five minutes before an actual alarm) or to the next chime (on every hour and half hour), resp.. The digital time display consists of five label widgets (tklabel) showing images for any digit and the (blinking) colon between hours and minutes display. The figure below shows any raster images used for that purpose:
Function "processTick" forms the heart of the program: invoked once per second, the alternative display of a visible or invisible colon indicates a properly functioning program. If need be (i.e., usually once per minute), the function also updates time and status display according to the actual time. Additionally, on every hour and half hour (as well as five minutes before) the Tk command "bell" is used to produce an audible signal. Apart from the "main program", "Chime" contains the following global functions (in alphabetical order):
Similar to the situation in "Clock", the simplicity of the internal timer function sometimes causes "Chime" also to "skip" a second - however, this behaviour doesn't affect the proper function of the program. Source CodeThe source code of this program is available for download:
In addition, all files required for the complete Chime example (this includes the source code as well) are available as a single ZIP archive:
References
|
| http://www.Andreas-Rozek.de/Lua/Examples/Chime/index_en.html | (last Modification: 14.04.2002) |