invalid command name "toplevel"
    while executing
"toplevel .top"
    (procedure "Affiche" line 10)
    invoked from within
"Affiche"
    (in namespace eval "::request" script line 162)
    invoked from within
"namespace eval ::request $script"
    ("::try" body line 12)

OUTPUT BUFFER:

#!/usr/local/bin/wish global lvarinit global NS set NS "" set lvarinit {} set lvarinit [info globals] set NS "nsdedepart::" namespace eval $NS {} proc FinChange {} { global NS variable ${NS}WDuTexte $WDuTexte configure -state disabled $WDuTexte configure -background white -foreground black destroy .top.bout1 destroy .top.bout2 button .top.bout1 -text "change" -command "PrepareChange" pack .top.bout1 -side bottom foreach v ${NS}$lvar { if {[lsearch $lvarinit $v] == -1} { puts $v } } return } proc Cancel {} { global NS set nom [string range $NS 0 end-2] namespace delete $nom set NS "nsdedepart" update FinChange return } proc CestOK {} { global NS variable ${NS}LeText variable ${NS}WDuTexte variable ${NS}NbLet set ${NS}NbLet [string length [${NS}$WDuTexte get 0.0 end]] set ${NS}LeText [${NS}$WDuTexte get 0.0 end] $WDuTexte delete 0.0 end $WDuTexte insert end ${NS}$LeText puts "${NS}$LeText" puts "${NS}$NbLet" namespace eval onchange { foreach v ${NS}$lvar { if {[lsearch $lvarinit $v] == -1} { puts $v variable nsdedepart::$v [set ${NS}$v] } } } set NS "nsdedepart::" update FinChange update return } proc ChangeText {} { global NS namespace eval $NS { variable ${NS}LeText variable ${NS}WDuTexte variable ${NS}NbrTouches puts "debut changetexte : [namespace current]" puts "${NS}$WDuTexte [set ${NS}$WDuTexte]" set ${NS}NbrTouches 0 ${NS}$WDuTexte configure -background DimGray -foreground green -state normal bind ${NS}$WDuTexte {incr ${NS}$brTouche} destroy .top.bout1 button .top.bout1 -text "OK" -background green -command CestOK button .top.bout2 -text "cancel" -background red -command Cancel pack .top.bout1 .top.bout2 -side left -fill x puts "fin changetexte : [namespace current]" } return } proc PrepareChange {} { global NS global lvarinit set NS "::onchange" namespace eval $NS { variable ${NS}lvar puts "debut prepachange : [namespace current]" set ${NS}lvar [info globals] foreach v [set ${NS}lvar] { if {[lsearch $lvarinit $v] == -1} { puts $v variable onchange::$v [set ${NS}$v] } } update puts "fin prepachange : [namespace current]" ChangeText } return } proc Affiche {} { global NS variable ${NS}LeTexte variable ${NS}WDuTexte variable ${NS}NbLet set ${NS}WDuTexte ".top.text" toplevel .top set font "Courier 16 bold" text .top.text -state disabled -font $font -width 30 -height 10 pack .top.text -side top button .top.bout1 -text "change" -command "PrepareChange" pack .top.bout1 -side bottom set ${NS}NbLet [string length [[set ${NS}WDuTexte] get 0.0 end]] puts "affiche : [namespace current]" return } Affiche #exit