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

  1. % package require Tk
  2. 8.6.10
  3. % entry .e -textvariable entryText
  4. .e
  5. % label .l
  6. .l
  7. % proc updateLabel {args} {.l configure -text [string toupper $::entryText]}
  8. % trace add variable entryText write updateLabel
  9. % pack .e .l
  10.  
  11.  

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}