LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   stupid tcl/tk error i can't debug (https://www.linuxquestions.org/questions/programming-9/stupid-tcl-tk-error-i-cant-debug-329119/)

AngelixD 06-01-2005 04:20 AM

stupid tcl/tk error i can't debug
 
I keep getting a weird error in line 2 of logInPressA, saying that "" is an invalid command. Well, of course that makes sense, but I don't know how that error is getting there. This is all of the code that runs up til that error, so I don't see why I get it. Do any of you have any insight?



Code:

proc logIn { } {
    toplevel .login
   
    pack [label .login.l1 -text "Enter your username ( =<10 chars ) and the server IP" ] \
        -anchor n
    pack [frame .login.f1]
    pack [entry .login.f1.e1 -relief sunken ] -fill x
    pack [entry .login.f1.e2 -relief sunken ] -fill x
    pack [button .login.f1.b1 -text "Send" -command { logInPressA } ] \
        -anchor e
}

# .login.f1.b1 -command start
proc logInPressA { } {
    puts "login [.login.f1.e2 cget -text] [.login.f1.e1 cget -text]"
    [ .login.l1 configure -text "Username request sent.  Please wait."]
    [ .login.f1.e2 configure -state disabled ] 
    [ .login.f1.e2 configure -state disabled ]
}

logIn


lvirden 06-27-2005 07:32 AM

The problem is putting the commands in [] in that proc. Remove the [] in the commands that are on lines by themselves and your error will go away.

[ .login.l1 configure -text "Username request sent. Please wait."]
[ .login.f1.e2 configure -state disabled ]
[ .login.f1.e2 configure -state disabled ]

becomes

.login.l1 configure -text "Username request sent. Please wait."
.login.f1.e2 configure -state disabled
.login.f1.e2 configure -state disabled

Otherwise, you are telling Tcl to execute a command returned by the configure statements - but the configure statement doesn't return a command to execute.


All times are GMT -5. The time now is 08:20 PM.