square revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
5b99af0079813347d90c935ea540ed7f96dcea38Stéphane Graber# the next line restarts using wish \
5b99af0079813347d90c935ea540ed7f96dcea38Stéphane Graber# This script generates a demo application containing only
5b99af0079813347d90c935ea540ed7f96dcea38Stéphane Graber# a "square" widget. It's only usable if Tk has been compiled
5b99af0079813347d90c935ea540ed7f96dcea38Stéphane Graber# with tkSquare.c and with the -DSQUARE_DEMO compiler switch.
5b99af0079813347d90c935ea540ed7f96dcea38Stéphane Graber# This demo arranges the following bindings for the widget:
5b99af0079813347d90c935ea540ed7f96dcea38Stéphane Graber# Button-1 press/drag: moves square to mouse
5b99af0079813347d90c935ea540ed7f96dcea38Stéphane Graber# "a": toggle size animation on/off
5b99af0079813347d90c935ea540ed7f96dcea38Stéphane Graber# SCCS: @(#) square 1.6 96/02/16 10:49:21
5b99af0079813347d90c935ea540ed7f96dcea38Stéphane Graber# The procedure below centers the square on a given position.
de9a4bfc2c488aef0055a25af834be9b22738cf0Stéphane Graber .s position [expr $x-($a/2)] [expr $y-($a/2)]
de9a4bfc2c488aef0055a25af834be9b22738cf0Stéphane Graber# The procedures below provide a simple form of animation where
de9a4bfc2c488aef0055a25af834be9b22738cf0Stéphane Graber# the box changes size in a pulsing pattern: larger, smaller, larger,
a38e3e325d651200b0aac77ef5287f36e8c46a63brauner if {$inc == 0} return
f24a52d5f588ff4e4575046903fb9498c376d833Stéphane Graber if {$s >= 40} {set inc -3}
6e39e4cbff5d49b4a66451696aa87b9884f58a6eStéphane Graber if {$s <= 10} {set inc 3}