Beginning Tk

Summary

An interactive community project to teach Tk scripting.

Description

This is a list of pages useful to those learning Tk. Please help add pages items and explanations, and arrange them in an order that would be mose useful for efficient learning.

General Information

What is Tk?
Tk syntax help
Tk glossary
When all you want is to run a Tk application
Common questions about Tk
ActiveTcl User Guide
For ActiveTcl
Tk performance
Apple Macintosh and Tcl/Tk
Microsoft Windows and Tcl
Microsoft Windows and Tk
Windows/CE
Pocket PC
Some common mistakes when programming in Tcl/Tk
Widgets in the initial Tk package
Coming to Tcl/Tk from an IDE environment

Basic Examples

The Hello World program as implemented in Tcl/Tk
Show me an example
takes the Hello World program farther.
Hello, Widgets! (a rock-bottom basic tutorial in Tcl and Tk)
Reinhard's demo editor
The beginnings of a text editor in about 200 lines of code. Although it is incomplete, it's a nice simple skeleton for a beginner to study. Use it as a tutorial by studying the successive commits. Tip: Use the diff functionality to visualize the development of the program.

Events

Event programming and why it is relevant to Tcl/Tk programming
Bindings and why they are important

Patterns

Interrupting loops
how to build a stop button
Overloading widgets
Writing Tk programs so that the user can do simple custimizations without modifying the application
Writing Tk programs so that the user can extend or interact with them without modifying the application
Adding User Data to Widgets the Megawidget Way
Some people have been asking (on news:comp.lang.tcl ) for the Tk core to be modified so that widgets all carry with them some additional user data. This is not necessary. The following script illustrates how you can do this without all that paraphernalia in pure Tcl...
the canvas as a data store
Serializing a widget

Developer Tools

Tcl/Tk Template Applications
a template for a basic Tk application

Menus

menu
Menus made easy

Dialogues

A file properties dialog

Fonts

How does one change the font in the wish widgets?

Text

A change-sensitive text widget
A little spellchecker
A little hypertext system
Text widget syntax highlighting
A minimal console
A minimal editor explained
How do I insert text programmatically at the current insertion point
in a text widget?
A do-it-yourself IDE with the text widget

Text Entry

An entry with a history

Canvas

An analog clock in Tk
Tkeyes
Text widget example
Shapes and Lights - a simple canvas script
A little function plotter
A minimal doodler explained
A tiny drawing program

Image

Tk image Dos and Don'ts

Layout

Paning widgets

Meter Displays

A simple voltmeter
Dial widget

Miscellaneous Examples

Widgets in the initial Tk package
many screenshots
Tk examples
A little file searcher
Scroll bars that appear only when needed
Bag of Tk algorithms
lots of little procs, help yourself
Which Widget
How to find the name and type of a TK Widget.

If you don't know Tcl all that well yet, you should visit Beginning Tcl to help you get the hang of the language that Tk is most commonly hosted in.