Posted to tcl by apn at Mon Jul 11 03:12:38 GMT 2022view pretty

% package require Tk
8.6.10
% entry .e -textvariable entryText
.e
% label .l
.l
% proc updateLabel {args} {.l configure -text [string toupper $::entryText]}
% trace add variable entryText write updateLabel
% pack .e .l

Comments

Posted by sbron at Mon Jul 11 11:43:44 GMT 2022 [text] [code]

You could also use validation: entry .e -textvariable entryText -validate key -validatecommand {updateLabel %P} proc updateLabel {str} {.l configure -text [string toupper $str];return 1}