Main Content

Cliff Lift simulator- Lynton to Lynmouth - in Tcl/Tk

Archive - Originally posted on "The Horse's Mouth" - 2007-12-14 10:31:52 - Graham Ellis

In Tk, you can use the variable option to a slider and the textvariable option to a label or button (or some other widgets) to 'project' the value of a variable onto the display - either changing the text on a button, or moving a slider automatically when some value changes otherwise within the code.

Cliff lifts such as the railway that runs up and down the hill between Lynton and Lynmouth on the north coast of Devon work on a counterbalance principle - as one car ascends the hill, a steel cable over a drum at the top lets the other car descend. And the whole lift works by making the car that starts at the top heavier by filling a water tank underneath the floor. That tank is then emptied when the car gets to the bottom.

Here are some Tk sliders ... showing how it works.



With the code that I wrote here, all I need to do is drag one car up or down and the other car moves equally and opposite, using the variable option on the scale command.

Link - Lynton and Lynmouth Cliff Railway