Event Logging
Below is a text widget that shows what events are happening as they
are occurring:
Source
text .t -bd 1 -background yellow -highlightthickness 0
pack .t -fill both -expand y
focus .t
proc Log {string} {
.t delete 1.0 end
.t insert insert $string
}
bind .t <Enter> {
Log "enter %d %f %x %y %X %Y %t"
focus -force .
}
bind .t <Motion> { Log "motion %x %y %X %Y %t"}
bind .t <Leave> { Log "leave %d %f %x %y %X %Y %t"}
bind .t <Any-Button-1> { Log "button 1 click %x %y %X %Y %s %t"}
bind .t <FocusIn> { Log "focus in"}
bind .t <FocusOut> { Log "focus out"}
bind .t <Any-Key> { Log "any"}
Log "Move the mouse over me"
|