Tk Tutorial

102 views
Skip to first unread message

Matt Gregory

unread,
Apr 1, 2005, 5:48:29 PM4/1/05
to
Can anyone recommend a Tk tutorial? I'm a C programmer, and I think
I get the Tcl part well enough, I just can't figure out the Tk part
and I'm sick of looking on the net. I tried to find a book, but the
bookstore didn't have anything. I just need enough information to
interpret the man pages.

Thanks!
Matt Gregory

Cameron Laird

unread,
Apr 1, 2005, 9:08:05 PM4/1/05
to
In article <1dk3e.12757$S46....@newsread3.news.atl.earthlink.net>,
.
.
.
Look at the first few entries on <URL: http://wiki.tcl.tk/TkTutorials >. I
think you might particularly like Tcl Tutor <URL: http://wiki.tcl.tk/1681 >.

Incidentally, if you'd posted with a valid e-mail address, <URL:
http://www.purl.org/net/tcl-welcome > would have been appeared
automatically in your in-box.

Matt Gregory

unread,
Apr 2, 2005, 1:35:52 AM4/2/05
to
Cameron Laird wrote:
> In article <1dk3e.12757$S46....@newsread3.news.atl.earthlink.net>,
> Matt Gregory <em...@invalid.net> wrote:
>> Can anyone recommend a Tk tutorial? I'm a C programmer, and I
>> think I get the Tcl part well enough, I just can't figure out the
>> Tk part and I'm sick of looking on the net. I tried to find a
>> book, but the bookstore didn't have anything. I just need enough
>> information to interpret the man pages.
> . . .

> Look at the first few entries on <URL: http://wiki.tcl.tk/TkTutorials
> >.

Tcl Tutor is strictly Tcl.

www.invece.org is not available.

www.purl.org/NET/Tcl-FAQ is a page of links.

www.tcl.tk is more links.

Ok, here's one:
http://www.geocities.com/binnyva/code/tcl/tutorial/index.html

http://phaseit.net/claird/comp.lang.tcl/tcl_tutorials.html is
a page of links

http://wiki.tcl.tk/1016 is a page of links.

ftp://www.tcl.tk/pub/tcl/doc/tut.tar.Z is something I don't feel
like dealing with.

http://www.tu-chemnitz.de/home/stb/tcl_tk/tcl_tk.html is in German,
so I'm out.

http://psg.com/%7Ejoem/CmdWrite.html gives me a 403 error.

ftp://ftp.lgc.com/landmark/users/papers/WMorse/wmorse.tcltk gives
me a 550 error.

http://www.icanprogram.com/ is a software company's home page.

http://freealter.com/fr/ProjetsLibres/tcltk/ is in French, so I'm
out.

http://www.csc.calpoly.edu/%7Edbutler/tutorials/winter96/tcl/ is
like three paragraphs long.

http://students.cs.tamu.edu/mmiller/tcl/ has a 31k .pdf that I
can't open at the moment.

http://students.cs.tamu.edu/mmiller/tcl/channel.html is an
introduction to Tcl channels.

http://photo.net/ is a digital camera review page or something

http://philip.greenspun.com/sql/ is an Oracle tutorial.

http://wiki.tcl.tk/638 is George Peter Staplin's personal projects.

http://www-106.ibm.com/developerworks/education/r-tcl.html?n-l-10181
goes to IBM Developerworks home page.

http://www-106.ibm.com/developerworks/edu/l-dw-linuxtcl-i.html?S_TACT=103AMW03&S_CMP=EDU
is a link to a Tcl/Tk tutorial, but you have to register, which is
fine maybe I'll do that. Maybe I'm already registered.

http://wiki.tcl.tk/20 is a page about MetaKit, which is a C++
database library.

http://wiki.tcl.tk/201 is a page of Expect links

http://wiki.tcl.tk/1950 is something for XML.

http://www.lisi.ensma.fr/ftp/pub/documents/papers/1999/copyrighted/1999-msr-grolleau.pdf
is in French and it requires a password to access it.

http://www.swen.uwaterloo.ca/~dasiewic/courses/ece452/local/old_tuts/trudeau-tck-intro.pdf
gives me a 403 error.

http://www.ibiblio.org/pub/Linux/docs/HOWTO/TclTk-HOWTO is a
page of links, basically.

http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/docbook/TclTk-HOWTO.sgml.gz
is the same thing, I guess.

http://hegel.ittc.ku.edu/topics/tcltk/index.html has some books
in PostScript, which I don't feel like dealing with because it's
very difficult to read. It also says these books are old and I
shouldn't use them.

http://hegel.ittc.ku.edu/topics/tcltk/tutorial-plugin/index.html
is a Tcl tutorial.

http://pages.cpsc.ucalgary.ca/~saul/personal/archives/Tcl-Tk_stuff/tcl_examples/
has some Tk examples.

http://www.pconline.com/~erc/tcl.htm redirects me to http://www.erc.edu/
which is the European Resuscitation Council.

http://wiki.tcl.tk/9058 is a theoretical discussion on teaching
programming to children.

http://www.freenetpages.co.uk/hp/alan.gauld/ is a beginner's programming
page that doesn't have Tcl anymore, apparently.

http://www.lib.uchicago.edu/keith/tcl-course/ is kind of a thrown
together Tcl tutorial.

http://wiki.tcl.tk/1415 is a discussion about the canvas widget.

http://wiki.tcl.tk/1054 is a discussion about the option command.

http://www.cs.man.ac.uk/~fellowsd/tcl/option-tutorial.html is a tutorial
about the options database, which looks useful if you have some
familiarity with Tk.

http://www.macdevcenter.com/pub/a/mac/2003/12/16/begin_programming.html
is a tutorial for children.

http://tcl.projectforum.com/young/Home is a tutorial for children.

http://www.ardenstone.com/projects/seniorsem/tcl/ is a Tk tutorial.


Ok, you're right. There are two Tk tutorials on that page: the fourth
link and the last link.


> I think you might particularly like Tcl Tutor <URL:
> http://wiki.tcl.tk/1681 >.

Yeah, I got that. It's pretty good, but it doesn't cover Tk.


> Incidentally, if you'd posted with a valid e-mail address, <URL:
> http://www.purl.org/net/tcl-welcome > would have been appeared
> automatically in your in-box.

Thanks!
Matt Gregory

Cameron Laird

unread,
Apr 2, 2005, 3:08:04 AM4/2/05
to
In article <c3r3e.2184$44....@newsread1.news.atl.earthlink.net>,
Matt Gregory <em...@invalid.net> wrote:
.
.

.
>Tcl Tutor is strictly Tcl.
>
>www.invece.org is not available.
>
>www.purl.org/NET/Tcl-FAQ is a page of links.
>
>www.tcl.tk is more links.
.
[miserable litany of
dozens of additional
misdirections]
.

.
>Ok, you're right. There are two Tk tutorials on that page: the fourth
>link and the last link.
>
>
>> I think you might particularly like Tcl Tutor <URL:
>> http://wiki.tcl.tk/1681 >.
>
>Yeah, I got that. It's pretty good, but it doesn't cover Tk.
>
>
>> Incidentally, if you'd posted with a valid e-mail address, <URL:
>> http://www.purl.org/net/tcl-welcome > would have been appeared
>> automatically in your in-box.
>
>Thanks!
>Matt Gregory

You're welcome. It's gracious of you to say so, after I gave
you such low-quality information.

You made it quite clear that you wanted Tk information; *that*
wasn't the problem. Clearly the Tutorials page needs updates--a
lot of them, from the evidence of your research.

My memory also needs updates. It perplexed me a LOT when you
wrote that TclTutor doesn't cover Tk, because I *know* that's
not so. I'm wrong, of course; TclTutor *used* to include
lessons on Tk, but Clif moved them aside in release 0.93. I'm
behind the times.

So, if you want to do something else for a few days, we'll work
on the Tutorials page over the weekend, and see how much more
useful and accurate we can make it. You're welcome to join in
on the corrections.

Matt Gregory

unread,
Apr 2, 2005, 9:44:32 AM4/2/05
to
Cameron Laird wrote:

> You're welcome. It's gracious of you to say so, after I gave you
> such low-quality information.
>
> You made it quite clear that you wanted Tk information; *that* wasn't
> the problem. Clearly the Tutorials page needs updates--a lot of
> them, from the evidence of your research.
>
> My memory also needs updates. It perplexed me a LOT when you wrote
> that TclTutor doesn't cover Tk, because I *know* that's not so. I'm
> wrong, of course; TclTutor *used* to include lessons on Tk, but Clif
> moved them aside in release 0.93. I'm behind the times.
>
> So, if you want to do something else for a few days, we'll work on
> the Tutorials page over the weekend, and see how much more useful and
> accurate we can make it. You're welcome to join in on the
> corrections.

Well, ok. I'm glad you didn't get mad at me for coming here at
immediately spewing off criticisms, but I've been having terrible
luck lately trying to find technological information in the
resources that are provided and I go to ask for help and the person
trying to help assumes that they are adequate and tells me to read
them again, but frankly I've had enough of this treatment and decided
to try and do something about it. I'm suffering from major information
overload and financial stress and I just want something easy for a
change :-)

I have tried to learn Tcl/Tk a few years ago and I found it
frustrating and gave up, but I recently found a page written by a
brilliant computer science professor by the name of Dr. Nikolai
Bezroukov at http://www.softpanorama.org/ and he highly recommends
learning Tcl/Tk and Expect, so I thought I would give it another go.
He has a very good article about it at
http://www.softpanorama.org/Scripting/tcl_tk_expect.shtml that
clarified many things about it for me, like the simplicity of its
design and why it was written and so forth. These are ideas I haven't
come across anywhere before.

Even though I don't know the language, I can tell that Tcl/Tk is far
too underrated and it seems to me that the people on this newsgroup
are very friendly (friendlier than most language newsgroups) and
willing to help people learn the language, which is good, but I just
think the way it's being done is too haphazard and it needs to be done
with more of a focus on making it easy for programmers of other
languages, especially C programmers (and sure, I'm biased, but what
the hell, why shouldn't I be? :-), to understand what the benefits of it
are and how it can be viable alternative to things like C++, which in
my opinion is a vastly overrated language. But the presentation of the
benefits needs to be addressed on a level that a programmer can
appreciate and on a level he won't be afraid to invest in it. The
tcl.tk site seems to assume that the programmer is going to pick up
Tcl/Tk and write some gigantic, mission critical, cross platform,
enterprise, database, internet enabled application with it. Maybe I'm
just out of the loop, but that doesn't seem very realisitic to me.
People use new languages for little things at first and try to coax the
language into doing bigger things. If the bigger things are easy
enough, then they won't need a web page telling them that all these
glorious features are possible because they'll be able to see that that
is the case. That whole tcl.tk site seems very pretentious to me,
pitting Tcl against other languages and all this nonsense. I would
never, from the position I'm in now with respect to Tcl/Tk, plan to
write a huge application with it. I'm only looking to write little
things with it. GUI front ends for CLI utilities and things that it
might help me write real fast. I'm not prepared to fully invest in it
because it would add another tool to the collection I have to lug
around. I want to know how well it can replace some of my other tools,
or if it can give me a big enough benefit to add it alongside before
I'm willing to invest in it. I personally only use "the right tool
for the job" if the "right tool" doesn't make my life a pain in the
ass. :-)

The reason I take the stance of targetting programmers instead
of newbies and children is because they are the ones who stand to
benefit most from Tcl/Tk, and also I'm assuming that more applications
need to be written using Tcl/Tk so that it can gain some exposure. I
basically think tutorials targetting newbies and children are a waste
of time. I personally don't think anyone should learn Tcl/Tk until
they at least learn one conventional language like Pascal or C, but
that's just me. I would even recommend BASIC over Tcl/Tk, since you
don't have to understand how it's parsed, which seems pretty essential
to me in understanding Tcl/Tk, but it's an unneeded complication when
learning how to program for the first time.

I think the TclTutor is good, but I have a couple of criticisms
about it. For one, I use Windows, and the interface is frustrating
because to resize the panes of it, you have to click on this tiny gem
looking thing and drag in the opposite direction of the resize action
and if you drag too much it starts resizing in other direction and
it's just very, very odd and frustrating. So, it gives the impression
that Tcl/Tk is odd from the get-go. Surely those bars could be made
to be dragged straightforwardly?

Another thing is that the three levels of terseness are unnecessary.
The beginner level is already fairly terse as it is and it contains
a lot of useful information that is simply omitted when you change
it to any other level. Plus I think the perspective of the
explanations is kind of wrong, really. If you go into lesson 2 and
set the terseness to "Expert", the first sentence says: "Set is the
assignment operator in Tcl". But from what I understand, "set" is
not an operator, it's a procedure, so I think it's kind of
misleading to explain it that way. If everything is a procedure in
Tcl, then I think adding more terminology on top of that only
creates unnecessary conceptual overhead.

I have come to the conclusion that programmers are for the most part
addicted to complexity, but they tend to apply it on such rudimentary
levels that they waste all of their mental efforts on trivialities and
consequently become too burned out to apply it where it would actually
be useful and this is an area where Tcl could really be of benefit to
people, since you don't have to strain your brain trying to figure out
how to state things in the language. "Make it as simple as possible,
but no simpler" is the mantra of the day, but very few programmers
understand what that means and many of them take it as a cue to start
pontificating on some totally inane computational obscurity that no one
in their right mind could possibly care about. So I think simplicity
is overlooked and people don't understand that it takes the same amount
of work to get to simplicity as it does to get to complexity, but once
you do get there, you'll be in a better position to do greater things,
since, having less, you'll be able to take more in.

About the example code thing. It's nifty and everything, but I think
it tends to put the reader in a passive state of mind. I think the
example code should just be put in the text of the lesson along the
output or effect that it has. It doesn't help to have it actually
execute since the result is the same. In fact, it makes the person
not bother to read the code and understand how it works. Knowing
/that/ it works is not the same as knowing /how/ it works.

I think each lesson ought to have a few exercises at the end for the
user to figure out, and the TclTutor could check the output of the
user's code, or some of them anyway, and if it's right it could give the
user a cookie or a Bozo button or something. You could even leave the
checking of it out and just have something like an "answers in the back
of the book" section of the program or whatever. I know it would be a
lot of work coming up with good exercises and everything, but this would
make the tutor much more mentally engaging and the user would get a lot
more out of it. I would think a company like ActiveState would be
willing to finance a venture in making a really good tutorial to
generate some interest in the language. I've been looking for books and
some of them are out of print and none of them are available in
bookstores, apparently, since I've been to a couple of big ones and no
Tcl books were to be found. It seems that if there are entities that
are dependent on Tcl/Tk for income then they would want to do something
to change this situation.

Anyway, if the exercises were geared towards the idea of creating
programming tools, like code and script generators, code and data
parsers, file management tools, and the idea of using Tcl as a glue and
batch language, then I think it wouldn't be too hard coming with
examples that would be engaging for the user since in the end the user
would have some useful scripts that he would understand and have a use
for. I would think it would be very easy to create a parser for Tcl.
Even C code isn't that hard if you use a consistent style. I do this
all the time with Perl. Makefiles are a pain in the butt, I always
whip up something to write those for me.

I think the writing in the tutorial is good, but I think, and I would
probably say this about most tutorials, I think it really needs a few
long running examples to thread the tutorial together. It's difficult
to remember what is in these lessons when there is no concrete context
given to them. If I were going to write a tutorial, I would set my
first goal as trying to write the first lessons so as to get to file
access as soon as possible, and then base a big portion of the tutorial
on file manipulation so that you have some substance to work with as you
talk about strings, lists and regular expressions. I suppose I'm
talking about a textbook now, though. I probably would end up writing a
textbook if I was serious about writing a tutorial.

I think the main point of all this is that someone learning a new
language needs a sense of accomplishment, they need to feel that what
they are doing is going to lead somewhere and this is best done by
giving him a rapid series of rewards at first and gradually making
them bigger, more challenging and more rewarding. It's like training
a dog or something :-) But trying to do something that could be
simple and not being able to do it is just too frustrating. The
manual pages would be sufficient, if they weren't so...insufficient :-)
I mean, the organization of it had to have been done in like 1989
or something. Can't we move on, please? I'm looking at the html files
that come with ActiveState (I think), and a list of commands is just
not sufficient. There's no way to know what the relationships between
the commands are by looking at a flat list, so it's hopeless trying to
figure out the language from the manual. I suppose I shouldn't complain
about that, since it's pretty normal, but how hard would it be to
categorize them? An hour's worth of work at the most? It just seems
ridiculous to me that it's like this. Can we just admit that the "man"
command totally sucks for documentation? I mean it sucks ass, that's
how bad it sucks. They come up with curses, which is used for video
games of all things, and "man" is all they could come up with? And it
is still being used to this day, what 30 years later, in 2005? Why not
just transmit the commands to me in morse code from my scroll lock LED?
I just have to wonder what people are thinking sometimes.

Well, I guess you guys are about ready to throw me out of this
newsgroup. I don't blame you for that, but worse things have happened
to me :-) I wouldn't take this post too seriously, though. I'm all
bottled up and given a chance to vent some steam, I'll do it :-)

Matt Gregory

David N. Welton

unread,
Apr 2, 2005, 10:04:51 AM4/2/05
to
Matt Gregory <em...@invalid.net> writes:

> Well, I guess you guys are about ready to throw me out of this
> newsgroup.

On the contrary, I think most of your criticism is of the constructive
sort.

As far as the Tcl tutorial I work on (*), which is based on TclTutor's
material, the idea of a 'thread running through it' is not bad, but
it's definitely subjective. Some people really like that, others, who
just want to jump in and look at something, go nuts because there is
all this *other* stuff (the 'Project') they have to figure out to even
get to the bit they are interested in. And in any case, more to the
point, I just don't have time to do it.

--
David N. Welton
- http://www.dedasys.com/davidw/

Apache, Linux, Tcl Consulting
- http://www.dedasys.com/

* http://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html

Roy Terry

unread,
Apr 2, 2005, 3:08:42 PM4/2/05
to

"Matt Gregory" <em...@invalid.net> wrote in message
news:c3r3e.2184$44....@newsread1.news.atl.earthlink.net...

> Cameron Laird wrote:
> > In article <1dk3e.12757$S46....@newsread3.news.atl.earthlink.net>,
> > Matt Gregory <em...@invalid.net> wrote:
> >> Can anyone recommend a Tk tutorial? I'm a C programmer, and I
> >> think I get the Tcl part well enough, I just can't figure out the
> >> Tk part and I'm sick of looking on the net. I tried to find a
> >> book, but the bookstore didn't have anything. I just need enough
> >> information to interpret the man pages.
> > . . .
[big list of broken or non-helpful links]

Matt,
your thoroughness is practically inspiring :*)

Indeed there is a lot of dead wood in the Tcl/Tk
cyberspace. I think this is mainly a consequence
of the boom/slack that Tcl (along with many other
technoligies) experienced from
1995 to 2001 -- Plus simple procrastination.

Anyway, I want to suggest an
alternative to a canned tutorial is
to learn by experimenting.

Set out some typical tutorial goals
like perhaps:

1. Make a Tk window with multi-line
text, a menubar and ability to read/save files.

2. Make a canvas that can be scribble upon

3. Practice using some of the "standard dialogs"
tk_chooseColor
tk_messageBox
tk_getOpenFile
tk_getSaveFile

4. Practise using images in labels

5. Practice placing widgets with pack/grid/place

6. ...

Adjust list to suit taste. I highly
advise using tkcon as your work console.

Most importantly, avoid frustration. When things
don't make sense just throw a couple of questions
(preferrably with code snippet)
here on the newsgroup and you'll get back on
track in no time. Again: Don't hesitate to pose
questions :^)

Cheers,
Roy

BTW,
Here is one link that may have been
overlooked (I apologize if you've seen it already)
http://www.linuxfocus.org/English/November2000/article174.shtml#lfindex4

> Thanks!
> Matt Gregory


Ian Bell

unread,
Apr 2, 2005, 6:33:08 PM4/2/05
to
Matt Gregory wrote:

>
> Well, I guess you guys are about ready to throw me out of this
> newsgroup. I don't blame you for that, but worse things have happened
> to me :-) I wouldn't take this post too seriously, though. I'm all
> bottled up and given a chance to vent some steam, I'll do it :-)
>
> Matt Gregory

As a releative newcomer myself to tcl/tk I would just like to say a couple
of things in reply.

First, this is probably the most helpful and informative group on the net.
Little if any flaming and no dumbing down of newbies. All my questions
have been answered courteously and in considerable detail.

Second, I think you expect too much from a mere tutorial. The level of
information you seem to need would more likely IMHO to be found in a book
and there are three I would recommend to you. They are:

Graphical Applications with Tcl and Tk by Eric Foster Johnson ISBN1 55851
569 0

Practical programming in Tcl and Tk by Brent Welch ISBN 0 13 022028 0

Exploring Expect by Don Libes ISBN 1 56592 090 2 - although not actually
about tcl/tk it has one of the most concise and readable introductions to
Tcl I have seen.

HTH

Ian

--
Ian Bell

Matt Gregory

unread,
Apr 2, 2005, 10:37:00 PM4/2/05
to

Well, don't mistake my intentions. I got my Tk tutorial - I'm perfectly
happy. I suppose I was being rude to Cameron, and I'm sorry about that,
but I do appreciate his help because it did get me where I wanted to be.
I was just trying to relate my inner experiences and ideas in case it
would help anyone who is interested in improving the promotion of
Tcl/Tk.

Matt Gregory

Binny V A

unread,
Apr 4, 2005, 3:18:09 AM4/4/05
to
I have written a Tcl/Tk tutorial and it is available at
http://www.geocities.com/binnyva/code/tcl/tutorial/

It was mentioned in the passing in this thread.

If you already know Tcl, feel free to skip to the Tk part
of this tutorial, which can be found at
http://www.geocities.com/binnyva/code/tcl/tutorial/tk.html

Hope it is helpful.

Binny V A
http://www.geocities.com/binnyva/

Dossy

unread,
Apr 4, 2005, 8:53:51 AM4/4/05
to
In article <kdy3e.2259$44....@newsread1.news.atl.earthlink.net>,

Matt Gregory <em...@invalid.net> wrote:
> I have tried to learn Tcl/Tk a few years ago and I found it
> frustrating and gave up, [...]

Indeed, I share your same frustration, Matt. Every couple of months, I
say to myself, "Hey, self, you should learn Tk." And so begins the
Googling for stuff on Tk, which turns up the usual suspects, none of
which are helpful.

What'd be REALLY cool (here's my wishlist) is if someone would put
together a website similar to the Photoshop tutorial sites, where you
have a gallery of screenshot thumbnails of a various Tk windows and each
thumbnail links to an article page with a full-sized image of the
window, with a step-by-step explanation annotating the Tcl source that
produces the window.

Start simple, with the "Hello, world." Tk window, progressing on with a
typical input form with save/cancel buttons, to a progress dialog that
shows a visual bar updating, a single document interface (SDI) window
and a multi-document interface (MDI) window.

Another section of the site might be screenshots and links to various
open-source Tcl/Tk applications, so people can go read the code and
see how the app. draws its windows, too.

-- Dossy

--
Dossy Shiobara mail: do...@panoptic.com
Panoptic Computer Network web: http://www.panoptic.com/
"He realized the fastest way to change is to laugh at your own
folly -- then you can let go and quickly move on." (p. 70)

Roy Terry

unread,
Apr 4, 2005, 10:42:05 AM4/4/05
to

"Dossy" <do...@panoptic.com> wrote in message
news:slrnd52e71...@ecwav.panoptic.com...

> In article <kdy3e.2259$44....@newsread1.news.atl.earthlink.net>,
> Matt Gregory <em...@invalid.net> wrote:
> > I have tried to learn Tcl/Tk a few years ago and I found it
> > frustrating and gave up, [...]
>
> Indeed, I share your same frustration, Matt. Every couple of months, I
> say to myself, "Hey, self, you should learn Tk." And so begins the
> Googling for stuff on Tk, which turns up the usual suspects, none of
> which are helpful.
>
> What'd be REALLY cool (here's my wishlist) is if someone would put
> together a website similar to the Photoshop tutorial sites, where you
> have a gallery of screenshot thumbnails of a various Tk windows and each
> thumbnail links to an article page with a full-sized image of the
> window, with a step-by-step explanation annotating the Tcl source that
> produces the window.
>
> Start simple, with the "Hello, world." Tk window, progressing on with a
> typical input form with save/cancel buttons, to a progress dialog that
> shows a visual bar updating, a single document interface (SDI) window
> and a multi-document interface (MDI) window.
>
> Another section of the site might be screenshots and links to various
> open-source Tcl/Tk applications, so people can go read the code and
> see how the app. draws its windows, too.

Agreed. Such a web site sounds ideal. As a partial stand-in I suggest
people look at the tk widget demos that install with Tk. If you install
AS Tcl they will get install automatically and can be invoked from
the start menu. The main demo page has the following sections
and each section not only gives you a live window to experiment
with, it also gives you a button to view the source. Perhaps not
as nice a format as you're suggesting but worth checking out.


--- Tk Widget Demonstrations ----

This application provides a front end for several short scripts that
demonstrate what you can do with Tk widgets. Each of the numbered lines
below describes a demonstration; you can click on it to invoke the
demonstration. Once the demonstration window appears, you can click the See
Code button to see the Tcl/Tk code that created the demonstration. If you
wish, you can edit the code and click the Rerun Demo button in the code
window to reinvoke the demonstration with the modified code.

Labels, buttons, checkbuttons, and radiobuttons
1. Labels (text and bitmaps).
2. Labels and UNICODE text.
3. Buttons.
4. Check-buttons (select any of a group).
5. Radio-buttons (select one of a group).
6. A 15-puzzle game made out of buttons.
7. Iconic buttons that use bitmaps.
8. Two labels displaying images.
9. A simple user interface for viewing images.
10. Labelled frames.

Listboxes
1. The 50 states.
2. Colors: change the color scheme for the application.
3. A collection of famous and infamous sayings.

Entries and Spin-boxes
1. Entries without scrollbars.
2. Entries with scrollbars.
3. Validated entries and password fields.
4. Spin-boxes.
5. Simple Rolodex-like form.

Text
1. Basic editable text.
2. Text display styles.
3. Hypertext (tag bindings).
4. A text widget with embedded windows.
5. A search tool built with a text widget.

Canvases
1. The canvas item types.
2. A simple 2-D plot.
3. Text items in canvases.
4. An editor for arrowheads on canvas lines.
5. A ruler with adjustable tab stops.
6. A building floor plan.
7. A simple scrollable canvas.

Scales
1. Horizontal scale.
2. Vertical scale.

Paned Windows
1. Horizontal paned window.
2. Vertical paned window.

Menus
1. Menus and cascades (sub-menus).
2. Menu-buttons.

Common Dialogs
1. Message boxes.
2. File selection dialog.
3. Color picker.

Miscellaneous
1. The built-in bitmaps.
2. A dialog box with a local grab.
3. A dialog box with a global grab.

--- end Tk Widget Demo main page --

Roy Terry

unread,
Apr 4, 2005, 10:44:46 AM4/4/05
to

"Roy Terry" <royt...@earthlink.net> wrote in message
news:1nc4e.81$An...@newsread2.news.pas.earthlink.net...

And I fogot to mention: You can edit the displayed code on the
spot and push a button to re-run the demo with your changes.

David N. Welton

unread,
Apr 4, 2005, 4:20:23 PM4/4/05
to

It would be a positive thing for the Tcl comunity to integrate your
work into the existing Tcl tutorial, and add your Tk work as well.

Khaled

unread,
Apr 4, 2005, 6:19:31 PM4/4/05
to
Hello,

Just to emphasize on the importance of good tutorials, I found this msg
in a python news group. This guy says that he started with Tcl and he
thinks that it shares the same advantages with python, being simple,
dynamic and with a very readable code.

However, he abandoned Tcl to Python because: "Python's tutorial was
done better".
http://groups-beta.google.com/group/fr.comp.lang.python/msg/1590c302203c9811

We should really, as Tcl'ers, start a project to write a nice looking,
easy-to-read, appealing and informative tutorial for Tcl _and_ Tk. I
believe this will be the greatest work of advocacy we might offer.

Rgrds,
Khaled

suc...@wanadoo.fr

unread,
Apr 4, 2005, 6:20:07 PM4/4/05
to
On Sat, 02 Apr 2005 20:08:42 GMT, "Roy Terry" <royt...@earthlink.net>
wrote:

>
>"Matt Gregory" <em...@invalid.net> wrote in message
>news:c3r3e.2184$44....@newsread1.news.atl.earthlink.net...
>> Cameron Laird wrote:
>> > In article <1dk3e.12757$S46....@newsread3.news.atl.earthlink.net>,
>> > Matt Gregory <em...@invalid.net> wrote:
>> >> Can anyone recommend a Tk tutorial? I'm a C programmer, and I
>> >> think I get the Tcl part well enough, I just can't figure out the
>> >> Tk part and I'm sick of looking on the net. I tried to find a
>> >> book, but the bookstore didn't have anything. I just need enough
>> >> information to interpret the man pages.
>> > . . .
>[big list of broken or non-helpful links]
>
>Matt,
>your thoroughness is practically inspiring :*)
>
>Indeed there is a lot of dead wood in the Tcl/Tk
>cyberspace. I think this is mainly a consequence
>of the boom/slack that Tcl (along with many other
>technoligies) experienced from
>1995 to 2001 -- Plus simple procrastination.
>
>Anyway, I want to suggest an
>alternative to a canned tutorial is
>to learn by experimenting.

i have started to learn tcl/tk two months ago, as you
propose "by experimenting" and when i have a problem i came
here and ask for help. Although my questions were extremely elementary
i received very complete answers in a friendly manner. The
documentation you refer to hereafter
is excellent and with the help of wicki.tcl.tk/... and the community
it is a pleasure to dig in tcl/tk. I devote little time to tcl/tk
because of a lot of work but i take a real pleasure to practice coding
in this language which is becoming my preferred language in both
aspects tcl and tk.
friendly
jerome

Matt Gregory

unread,
Apr 4, 2005, 7:55:00 PM4/4/05
to

I think Binny's tutorial is excellent. It worked for me, anyway.
It's short and to the point and told me everything I needed to know
to understand the man pages. Aside from a few grammatical and
spelling errors, it's very clear and well written. Thanks Binny!

Matt Gregory

suc...@wanadoo.fr

unread,
Apr 5, 2005, 3:01:57 AM4/5/05
to
On Mon, 04 Apr 2005 23:55:00 GMT, Matt Gregory <em...@invalid.net>
wrote:

To me it seems unnecessary to specify.

Matt Gregory

unread,
Apr 5, 2005, 7:00:09 AM4/5/05
to
suc...@wanadoo.fr wrote:

>> " Aside from a few grammatical and
>>spelling errors"
> To me it seems unnecessary to specify.

Many people judge a person's intelligence by their grammar and
spelling. I just wanted to make the point that Binny is an
intelligent person.

Matt Gregory

Khaled

unread,
Apr 5, 2005, 7:11:56 AM4/5/05
to

Otherwise, M$-Word would score a 140 in IQ tests ! ;-)

David N. Welton

unread,
Apr 5, 2005, 11:53:02 AM4/5/05
to
"Khaled" <ks...@free.fr> writes:

> We should really, as Tcl'ers, start a project to write a nice
> looking, easy-to-read, appealing and informative tutorial for Tcl
> _and_ Tk. I believe this will be the greatest work of advocacy we
> might offer.

Well, we have the Tcl portion of it. You can check it out of CVS and
look it over:

cvs -z3 -d:pserver:anon...@cvs.sourceforge.net:/cvsroot/tcl co -P tcltutorial

(look in the html directory).

Comments, patches, ideas, suggestions and other contributions are all
welcome!

Kevin Walzer

unread,
Apr 5, 2005, 11:14:42 PM4/5/05
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've been meaning to look at Binny's tutorial--it looks like an
outstanding resource, a good place to pick up the basics with very
succinct examples. Thank you, Binny.

My path to learning Tk (which continues still) was Brent Welch's book,
which is probably the best programming book I have read in any language
(I've got titles on C, C++, Objective-C, Python, and AppleScript on my
shelf): it's both a great introduction and a great reference. The
chapter "Tk by Example," which walks you through a simple Tk
application--not just dialogs and buttons, but a whole small
application--is superb, at least for my learning style.

Add the wiki and c.l.t., and you have an incredibly rich community.
That's where the current energy is, not in older tutorials that were
written in 1996.

Good luck!
- --
Cheers,

Kevin Walzer, PhD
WordTech Software--Open Source Applications and Packages for OS X
http://www.wordtech-software.com
http://www.smallbizmac.com
http://www.kevin-walzer.com
mailto:s...@wordtech-software.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCU1QhJmdQs+6YVcoRAnETAJ4qTlYw8JA1p65h51Zd2lJxfq5JVwCfa8Cs
B8tXpobARMbq45dd1oiLQyk=
=5nYp
-----END PGP SIGNATURE-----

Binny V A

unread,
Apr 6, 2005, 12:17:37 AM4/6/05
to
Thank you for your compliments.

If you have spotted any errors in my tutorial,
please let me know - so that I can correct it.
And sorry about the errors - I am not a native
english speaker, so I am entitled to a few errors. ;-)

Binny V A
http://www.geocities.com/binnyva/code

Reply all
Reply to author
Forward
0 new messages