Online Tcl and Tk Tutorials

Document various useful online or interactive Tcl and Tk tutorials. The official Tcl tutorial is discussed at tcltutorial.

These lists have been organized into "tutorial" order, i.e., the order a reader might access them in for most efficient learning. This order takes into account both the quality of the tutorial and the complexity of the information it presents.

Note: This ordering was undertaken on 2012-08-22, and updated on 2013-03-08

Please help collaboratively bubble-sort this list by choosing two consecutive references, evaluating their content, and swapping their order if appropriate! New links should be added at the top of a list to give them the benefit of the doubt, after which, the bubble-sort process will hopefully take them to their proper place

Tcl Tutorials

Title/Link Description Note
Tcl Tutorial by Jan Bodnar. Exceptionally clear and readable
Tcl Tutorial by TutorialsPoint . PDF download avilable This site sometimes has very outdated ways of doing things. Be warned.
The official Tcl Tutorial A Tcl 8.5 tutorial written by Clif Flynt, Neil Madden, Arjen Markus, David Welton and others. The tutorial is intended as a companion to the Tcl manual pages which provide a reference for all Tcl commands. It was written with the goal of helping those who have some knowledge of programming, although they certainly don't have to be experts.
http://www.invece.org/tclwise/ Tclwise: Guide to the Tcl programming language, by Salvatore Sanfilippo. This book is an introduction to the main ideas of the Tcl programming language: If you wish to learn a simple and powerful programming language, this book is for you. RS highly recommends this - when reading it, I more than once thought, "wish I had written that myself..." :)
Programming in Tcl Video tutorial on Tcl. Multiple chapters. Seems pretty complete.
https://en.wikibooks.org/wiki/Tcl_Programming A wikibooks complete and free Tcl/Tk book/tutorial with nice examples by Richard Suchenwirth
Tcl Tutorial ,by Chris verBurg No mention of {*}, but lots of small examples
http://openocd.sourceforge.net/doc/html/Tcl-Crash-Course.html Tcl Crash Course ,openocd project
Learn Tcl in Y Minutes by PYK. A concise walkthrough and cheatsheet for Tcl 8.6
http://philip.greenspun.com/tcl/index.adp Tcl for Web Nerdy, by Philip Greenspun, An intro to Tcl using AOLServer as the web engine. Some additional tutorials are mentioned in the summary
Tool Command Language by Jan Newmarch
Tcl Scripting with nmrWish last updated 2009-09-14
http://tcl.projectforum.com/young Broken link a work in progress providing a tutorial for young people.
Beginning Tcl An interactive community project to teach Tcl scripting On this wiki
Arts and Crafts of Tcl-Tk Programmingand another index to introductory pages, or pages covering fundamental concepts. On this wiki
Intermediate Tclan intermediate tutorial composed of pages on this wiki
Advanced Tclanother, more advanced tutorial composed of pages on this wiki
Superlinux Tcl/Tk Video Tutorials Youtube playlists in Arabic and English, of video tutorials Superlinux on his channel ( ranixlb ) . More than 36 episodes of tutorials. Install this Android application
Superlinux Tcl/Tk AndroWish Video TutorialsThose are video tutorials in spoken Arabic and in English packaged in an Android app. Teaches You how to make applications on Android using Tcl/TkDownload from here.
Superlinux Tcl/Tk Video Tutorials Recently (2019) liberated materials from Superlinux in English. In the form of a youtube playlist.
http://www.ardenstone.com/projects/seniorsem/tcl/ A Non-Programmer's Introduction to Tcl/Tk Stuck with pre-2005 practices, but the basics have changed little since then.
http://www.cwflynt.com/CS146GameLab/ Clyf Flynt's Tcl Tutorial
http://www.icanprogram.com/09tk/main.html icanprogram website
http://www.bin-co.com/tcl/tutorial An online tutorial written by Binny V Abraham.Out of date (pre-8.5) or maybe even older
http://www.doulos.com/knowhow/tcltk/ Doulos offers a 3-day Essential Tcl/Tk instructor led class
Tcl Tutor an interactive tutorial for learning Tcl Recent versions cover only Tcl, not Tk
http://www.purl.org/NET/Tcl-FAQ/ Broken link has a variety of pointers to tutorials
http://groups-beta.google.com/group/comp.lang.tcl/msg/7f593de071477d64 Roy Terry recommends a particularly experimental trajectory.
http://www.phaseit.net/claird/comp.lang.tcl/tcl_tutorials.html Broken link contains pointers to a varity of tutorials
ftp://www.tcl.tk/pub/tcl/doc/tut.tar.Z A series of PostScript slides used in an introduction/tutorial on Tcl and Tk at several X and Usenix Conferences
http://jbenjamin.com/docs/tcl.html A Tcl/Tk and Expect Tutorial by Will Morse (mailto:[email protected] )
http://www.icanprogram.com/
http://www.icanprogram.com/09tk/main.html
free online (beginner level) programming courses using Tcl/Tk as a programming language
http://photo.net/ filled with interesting information for the Tcl programmer. For instance, http://photo.net/sql/ appears to be a working draft of a book initially called "SQL for Web Nerds". It is a tutorial on SQL, using the AOLserver as a base and Tcl as the programming language. There are other items such as http://photo.net/wtr/dead-trees/ , which is the web version of the book "Database Backed Web Sites". Then there is the ArsDigita Community System, a database driven web forum.
http://user.xmission.com/~georgeps/documentation/tutorials/ George Peter Staplin GPS has written some tutorials on how he uses movies, audio, images and PNG cursors with Tcl/Tk in a game he is writing.
http://tldp.org/HOWTO/TclTk-HOWTO.html A rather old document oriented towards Tcl/Tk 8.0 Perhaps one of the Linux users here on the wiki would consider updating http://cvs.tldp.org/go.to/LDP/LDP/howto/linuxdoc/TclTk-HOWTO.sgml?revision=HEAD&view=markup and then submit the changes back to tldp.org ?
http://www.oreillynet.com/pub/a/mac/2003/12/16/begin_programming.html Broken link Michael Norton's Elementary Computer Graphics article is a Tcl tutorial
ftp://ftp.oreilly.com/pub/convention/os/tutorial/tcltk.pdf by Scriptics one of the best Tcl/Tk tutorials imho
http://www-106.ibm.com/developerworks/edu/l-dw-linuxtcl-i.html?S_TACT=103AMW03&S_CMP=EDU IBM beginners Tcl/Tk quick start web-based tutorial. This introduction is not fully up-to-date, and has enough questions and errors that one might hesitate to point newbies to it. This tutorial has proven to be less then ideal (written by a non-Tcl type), so this one should be last on your list of sites to learn about Tcl.
https://www.youtube.com/channel/UCXLcY5Ik9mbHDCD3jyAR7zA YouTube Channel "Web of Engineering" - There are some vídeos for very beginners in Tcl/Tk language. The tutorials are in portuguese, but there are links to GitHub where you can download the codes created during the tutorials.
https://exercism.org/tracks/tcl This site teaches a lot of languages with a task-oriented approach where the learner is taught to write small but useful applications. I am entering this item here on 2023-04-16.

Tk Tutorials

Title/Link Description Note
Tcl/Tk tutorial By Jan Bodnar. Concise, clear, easy to read
http://www.tkdocs.com/tutorial/index.html An excellent tutorial on Tk & ttk best practices by Mark Roeseman. Covers Perl, Ruby and (soon) Python language bindings to Tk, as well as Tcl.
http://www.icanprogram.com/09tk/main.html icanprogram website
http://www.cwflynt.com/CS146GameLab/ Clyf Flynt's Tcl Tutorial
http://tldp.org/HOWTO/Scripting-GUI-TclTk/ old document, but good for beginners

Tcl Web/CGI/HTML Tutorials

  • BOOK Tcl for Web Nerds is an online book/tutorial. CL advises regarding updates of this resource: "Not recently. FAR from recently. And its culture is quite different from what most Web beginners in 2008 expect. It's the best suggestion I know, though."
  • Tutorials about Rivet ( The Tcl alternative to PHP ) as a video playlist packaged in an Android application. Made by superlinux. Get from here

Other languages

Specialized/Advanced

Title/Link Description
http://psg.com/~joem/tcl/CmdWrite.html An HTML version of the TclCommandWriting man page that comes with TclX. Explains the C API to Tcl, providing an introduction/tutorial on writing Tcl extensions. APN This page is way out of date as it is based on the old char* based APIs and not Tcl_Objs.
http://www.cs.man.ac.uk/~fellowsd/tcl/option-tutorial.html A tutorial on the option database
http://captaincrumb.browseireland.com/docs/computing/tcl/tk/canvas/ Captain Crumb explains canvases, with a focus on animation.
http://www.markroseman.com/tcl/mktcl.pdf tutorial on Metakit by Mark Roseman
http://www.magicsplat.com/book Chapters on Tcl programming for Windows
http://www.magicsplat.com/articles/oo.html Tutorial on TclOO
http://www.magicsplat.com/articles/tdbc.html Basic Introduction to TDBC

Other related pages on this wiki

Dead References

The following references currently seem to no-longer be accessible. Rather than delete them, they are listed here as an aid to discovering lost content. Before moving references ot this section, try to confirm that the resource is really gone, and not just temporarily unavailable. Also, it may be possible to link to an archived version of the original content, perhaps at http://www.archive.org .

Title/Link Description Note
Source code: [L1 ] The X Resource, Issue 11 (July 1994), pp 205-248: A tutorial Introduction to Tcl and Tk, by Graham A. Mark [L2 ]
http://www.cs.tamu.edu/people/mmiller/tcl/ Tcl 8.0 tutorial by Michael S. Miller, based on the John Ousterhout tutorial, as well as Tcl UDP and a disk usage application. The creator also has some online doc for Tcl UPD and Tcl channels at http://www.cs.tamu.edu/people/mmiller/tcl/channel.html
http://www.swen.uwaterloo.ca/~dasiewic/courses/ece452/local/old_tuts/trudeau-tck-intro.pdf

dprasad - 2016-06-08 19:54:52

Hi, i have 2 lists list1 = {1 2 3 4 5} list2 = {6 7 8 9 }

i want to merge two lists to a new list which gives a result {1 2 6 3 4 7 5 8 9} it will take 2 element from list1 then 1 element from list2 and when condition finish it will print as it is shown in the above example.

please write a generic code.

Let's move this to TCL programs for beginners after you read it, not very concise but it could be a good basic example:

 set result {}
 set list1 {1 2 3 4 5}
 set list2 {6 7 8 9}
 foreach {eL1a eL1b} $list1 eL2 $list2 {
    if {[info exists eL1a] && $eL1a != ""} {lappend result $eL1a}
    if {[info exists eL1b] && $eL1b != ""} {lappend result $eL1b}
    if {[info exists eL2]  && $eL2  != ""} {lappend result $eL2}
 }
 puts $result

or

set list1 {1 2 3 4 5}
set list2 {6 7 8 9}
set result [concat {*}[lmap {a b} $list1 c $list2 {
    concat {*}[list $a $b $c]
}]]

or

set result {}
set list1 {1 2 3 4 5}
set list2 {6 7 8 9}
foreach {a b} $list1 c $list2 {
    lappend result $a $b $c
}
set result [lmap item $result {
    if {$item ne {}} {
        set item
    } else {
        continue
    }
}]