You are on page 1of 3

1. TCL stands for tool command line and TK stands for tool kit.

It is a scripting language
2. For executing the program firstly change the mode of the file by using the command:

Chmod +x filename.tcl ls (if the file name appears green this means the mode has been
changed)

3. The header file to be used in linux for executing the program is:
#!/usr/bin/tclsh (if we want to see the output on terminal)
#!/usr/bin/wish (if we want to see the output on gui)
tclsh : tcl shells
wish : windows shell
4. To create and open a program we use :
gedit filename.tcl
if the file already exists then it gets opened directly and if it is not present in the directory
then it gets created and is then opened.
5. To execute a file the command is:

./Filename.tcl

6. To get the output we use puts


Eg. putshi
7. To evaluate an expression we use expr
8. To find the power we use pow
Eg. [expr pow($number,$power)]
9. To assign a value to variable we use set
Eg. set a 10
10. To find the exponential of the term we use exp
Eg. set e[expr exp(1)]
11. To find the logarithm of the term we use log
Eg. [expr log($e)]
12. To terminate in between the program we use the command: Ctrl+c
13. The syntax of FOR loop is :
For{set i o} {$i<= 10} {incr i}
14. To check the size of an array the command is :
puts[array size array_name]

15. To find the value of index :


puts[index variable_name index_no]
eg. set var{23345}
puts[index $var 2]
16. To find the length:
puts[llength variable_name]
eg. puts[llength $var]
17. To sort the elements the command is: lsort
Eg. set var[lsort $var]
18. To replace one element with another the command is:
Set var[lreplace $var position item]
19. To display the array indices command is :
puts[array names array_name]
20. For the iteration of an associative array foreach loop is used instead of for loop
21. The use of nonewline and without nonewline in the generation of 3-D array can be seen by
the way of the orientation of the data they give on output i.e.
The orientation of data with nonewline is:
X X X
X X X
X X X
And the orientation of data without nonewline is:
X
X
X

X
X
X

X
X
X
22. The switch and case statements are similar to if-else statement
23. Clear command is used to clear the terminal
24. To delete a file in linux we use the command: rm rfv filename
25. cat is the command that is used to read the file without opening the file
26. upvar is the command that is used for accessing the values and putting them in to new place
or variable
eg. upvar$aa_
27. there are two types of calling a value inside a program i.e.
a. call by copy
b. call by reference

in call by copy the copy of a value is called and in case we change the value than the
original value does not get affected i.e. the original value remains same

in call by reference the actual value is called from its original location and if we in case
change the value than the original value also gets changed

28. textvar is a variable that should be declared globally to get the value
29. if we declare a variable as global then we can access it anywhere inside the program
30. to generate a label inside a tcl program the command is :
label.label_name
31. to create a button the command is :
button.button_name textvariable-text..-commandprocedure_name
32. to see the combines gui consisting of buttons and labels the command is:
pack.label_name.button_name
33. to pass multiple arguments the command is:
proc multi_add{args}
34. we define the procedure as: proc procedure_name
35. to display the message box tk provides a direct command i.e. tk_messageBox title
messgae .. type. icon..]
36. underline charPosition command is used to select the position of the hot key
37. -tearoff allows a menu to be removed from the menubutton and displays it in a permanent
window.
38. Toggle key word is used to toggle any check box selection
39. The command used to hide or reduce is : forget
40. To insert a frame the command is:
Frame.f borderwidth width background color
41. -orient command is used to set the orientation
a. h horizontal
b. v vertical
42. there are different writing styles like bold, groove, flat
43. to create a radio button there is a direct command i.e. radiobutton
44. to create a list box there is a direct command i.e. listbox
45. for the cursor selection the command is curselection
46. tk_choosedirectory command to capture indices
47. tk_choosecolor to open the color palette
48. The command used to set the font of the text is: -fontansi 12 bold
49. Nested procedure: a procedure inside another procedure that is called automatically
50. To input a button inside a top level the command is: button.top.but

You might also like