Setup of a Tk tutorial

Arjen Markus (10 june 2005) With the Tcl tutorial getting mature, it is time to do the same for Tk, IMO. This page is meant to record the structure/contents of such a tutorial.

RLH If you need any Windows side-of-the-house screenshots, let me know.


Introduction: what is Tk? Include a small example that shows the flavour of Tk programming - something like:

  • Create three widgets: label, entry and pushbutton
  • Use [grid] to put them in the main window
  • Print the variable connected to the entry

(I have written a draft for this particular chapter)

Chapter 2: Overview of widgets

Chapter 3: Managing toplevels

Chapter 4: Menubars

Chapter 5: Selecting files, using message boxes, etc.

Chapter 6: Geometry management, also frames

Chapter 7: Using simple widgets

Chapter 8: Using scrollbars

Chapter 9: The text widget

Chapter 10: The canvas widget

Chapter 11: Keeping your GUI alive

Chapter 12: Event handling

Chapter 13: Colours and fonts

Chapter 14: Images

Chapter 15: Meta-widgets

Chapter 16: The option database

Chapter 17: Tk beauty farm - how to make your app pretty -- RLH shares his thoughts: This should weave all the way through the tutorial -- EKB could/should usability also be woven through the tutorial? -- schlenk I think some basic techniques for beautifying Tk apps should be mentioned in all appropriate places, but sure would be good to collect advanced techniques in a separate section.

Examples, examples, examples...

... to be continued ...


escargo 14 Jun 2005 - I have been reexperiencing the Joy of Tclets again, since the Tcl Plugin now can be deployed on Firefox. Perhaps the Tk tutorial can be made into an interactive web-based tutorial with working examples using the Tcl/Tk Tclet Plugin. Certainly, understanding the pack algorithm can be made easier by using the interactive Pack Geometry Manager Demo[1 ]. Jeff Smith 2019-09-06 : Below is the Pack Geometry Manager Demo online using CloudTk

I suppose depending on the plugin could be a risk; if it isn't available, a very useful quality would be lost. Still, there is much to gain by using it.

I suppose an alternative would be to provide a starkit (or starpack) with equivalent functions; the disadvantage there might be the usual one of deploying new versions. All these alternatives are worth considering. To the extent that live examples are beneficial, any of these approaches should be considered before getting too far along in the Tk tutorial development process.

Is there a way to deploy read-only tclets in the wiki? Think about how people might be able to comment on a tclet on the same page that loaded it. (I suppose that making the tclet editable would not be too risky because of the security isolation of the plugin, but I'd rather not risk that.)

RLH 14 Jun 2005 - I would prefer an online one to compliment the Tcl tutorial that is being worked on.

escargo 15 Jun 2005 - Could you expand on what you mean by "online"? There are a spectrum of implementation options that would count as "online". One would be static web pages; someone could download these to examine at their convenience. (If we take that approach, I hope the pages are checked for compatibility with Plucker. I have downloaded some of the Snit documentation, and the HTML used is a bit too rich to translate well.) Another way would be more interactive, using the Tcl/Tk Tclet Plugin. That might not download so well, and it requires some software installation on the part of the user. There must be other variations as well. What did you have in mind?

davidw - Interactive is nice, but is too high a barrier to entry... get the plugin, install the plugin, etc... You will lose people that way. If it's just an added extra that enhances the tutorial for those who have the plugin...well, that's good:-)

escargo - If we plan for graceful fall back, we could have it both ways. Especially for layout using pack we could have explanations and illustrations, and then an interactive supplement using the plugin. We could adopt a groundrule that everything should have explanation, illustrations, examples and then where code is readily available an interactive illustration (with example code).


Readers who have an interest in a tk tutorial, and who don't mind seeing a few references to other languages, can take a look at http://www.tkdocs.com/ where Mark Roseman has really provided a series of excellent introductory articles on tk.