Posted to tcl by evilotto at Tue Apr 01 21:59:42 GMT 2014view raw

  1. label .el -text "Sync"
  2. entry .e -width 10 -textvariable t
  3. label .e2l -text "Async"
  4. entry .e2 -width 10 -textvariable t
  5. text .t -width 20 -height 4
  6.  
  7. grid .el .e
  8. grid .e2l .e2
  9. grid .t -
  10.  
  11. proc callback_sync {w} {
  12. .t insert end "start callback"
  13. update idletasks
  14. after 1000
  15. .t insert end "done"
  16. }
  17.  
  18. proc callback_async {w} {
  19. .t insert end "start callback"
  20. after 1000 {.t insert end "done"}
  21. }
  22.  
  23. bind .e <Key> {callback_sync %w}
  24. bind .e2 <Key> {callback_async %w}