-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Tcl/Tk 8.5 Programming Cookbook
The primary usage of the error command is to programmatically raise an error. This allows you to interrupt the interpreter at the desired point and to present the user with an error message of your choice.
To complete the following example, we will need to create a Tcl script file in your working directory. Open the text editor of your choice and follow the given instructions.
In the following example, to illustrate, we will generate an error and a supporting error message in a location where it should not occur. Using the editor of your choice, create a text file named error.tcl that contains the following commands:
if {1+1==2} {
error "My Error"
}
After you have created the file, invoke the script with the following command line:
% tclsh85 error.tcl
My Error
while executing
"error "My Error""
invoked from within
"if {1+1==2} {
error "My Error"
}"
(file "error.tcl" line 1)
child process exited abnormally
%
As you can see, in the...
Change the font size
Change margin width
Change background colour