#!/usr/bin/wish label .l1 -text "Name: " label .l2 -text "Phone: " entry .name entry .phone pack .l1 .name .l2 .phone -side left bind .phone { set nop 0 } bind .phone { if {[lsearch {BackSpace Tab Left Right Control_L Control_R} %K] >= 0} { return } if { [regexp {[0-9-]} %K] || "%K" == "minus" } { return } bell break }