About Tclets


Tclet is the abbreviated form of Tcl Applet. An applet is nothing but another name for an application program. So, a Tclet is actually an application program written in Tcl.

Your first Tclet!
Creating your first Tclet is extremely easy. Following is the shortest and simplest Tcl Tk program that you’d ever come across! Just create a file titled basic.tcl and write the following program inside it:
button .b –text “Hi, Everyone!”
pack .b


Now create an HTML file titled ‘basic.html’ and include the following HTML code inside it:
< p >Here’s my first ever embedded tclet:< /p >
< p >< embed src=”basic.tcl” width=150 height=40 >< /p >


And that’s about it!
You can even test the Tclet you just created by running it inside a wish shell. However, please keep in mind that when you run it inside the Tcl plugin, you’ll be restricted by the number of Tcl commands available to you owing to security reasons. Following are some of the Tcl commands that may not be available:
- Menu: for display of a menu
- Cd: for changing the directory
- Bell: for ringing the terminal bell
- Toplevel: for creation of toplevel windows
- Pwd: for querying the current directory
- Grab: for grabbing the cursor
- Clipboard: for accessing the CLIPBOARD selection
- Socket: for opening a network socket
- Wm: for window manager control
- Send: for sending the Tcl commands to the other Tk based applications
- Exec: for running programs
- Tk: for querying or setting the Tk application name
- Socket: for opening a network socket