1

Код:

entry  .entry   -textvar a
bind   .entry <Return> {Vvod a; continue }
pack   .entry   -side left

proc Vvod {a} {
global u
set u [format "%d" $a]
puts stdout "u = $u"
}

При выполнении выдаётся следующий текст -

expected integer but got "a"
expected integer but got "a"
    while executing
"format "%d" $a"
    (procedure "Vvod" line 3)
    invoked from within
"Vvod a"
    (command bound to event)

Как исправить ошибку? ...

1 ответ 1

0

Процедура "Vvod" вызывается со строкой "a", а не со значением переменой $a. Т.е. строку:

bind   .entry <Return> {Vvod a; continue }

нужно исправить как:

bind   .entry <Return> {Vvod $a; continue }

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.