# CARITA QUE GUINIE EL OJO AL DAR CLICK A UN BOTON
# ________________________________________________
# ------------------------------------------------
frame .f -background green -borderwidth 3
# _______ __ ________
# VENTANA
# ------- -- --------
canvas .f.dibujo -width 600 -height 300
set OjoIzq 0
set OjoDer 0
#________________________
# Inicio del Dibujo
#________________________
.f.dibujo create oval 200 050 400 250 -outline blue
.f.dibujo create line 300 150 300 170 -fill blue
.f.dibujo create line 280 200 320 200 -fill blue
button .f.o_izq -width 1 -height 1 -textvariable OjoIzq -borderwidth 0
button .f.o_der -width 1 -height 1 -textvariable OjoDer -borderwidth 0
place configure .f.o_izq -x 255 -y 105
place configure .f.o_der -x 320 -y 105
button .f.b_izq -width 10 -height 2 \
-text IZQUIERDO -borderwidth 5 -relief sunken \
-bg green -command { ojo .f.b_izq }
place configure .f.b_izq -x 50 -y 200
button .f.b_der -width 10 -height 2 \
-text DERECHO -borderwidth 5 -relief sunken \
-bg green -command { ojo .f.b_der }
place configure .f.b_der -x 450 -y 200
pack .f .f.dibujo
proc ojo { nombre } {
global OjoIzq OjoDer
switch $nombre {
.f.b_der { if { $OjoDer == 0 } then {
set OjoDer "_"
} else {
set OjoDer 0
}
}
.f.b_izq { if { $OjoIzq == 0 } then {
set OjoIzq "_"
} else {
set OjoIzq 0
}
}
}
}