[Tutor] Learn as You Go. Tkinter, PIL, Pmw, etc. and Toolkits--Choices

Alan Gauld alan.gauld at btinternet.com
Sun Apr 5 17:16:22 CEST 2009


"Wayne Watson" <sierra_mtnview at sbcglobal.net> wrote

> >  The grid is a perfectly good layout manager but like all such
> >  tools it works in a particular way and has lots of options. Some
>
> To me grid looks like simple arithmetic, +, -, * and /, but someone
> left out the description (in a fictitious book on arithmetic) of "/ 
> "(division).

You really need to refer to the Tk documents.

Here is the Tk reference for Grid.

http://www.tcl.tk/man/tcl8.4/TkCmd/grid.htm#M18

The example at the end is, of course, in Tcl/Tk but the documentation
of the options all appllies in Tkinter as well. In particular the 
explanation
of the master/slave concept and the algorithm used by grisd is useful
reading. But it is not easy stuff, it is written for professionals and
assumes a fair knowledge of GUI programming concepts.

> I suspect the New Mex Tech doc is among the more comprehensive,
> but not quite right for beginners.

This is a Tkinter document and as such is very good, but it
still IMHO doesn't cover the depth of the Tk docs

>  The now official extension library to Tkinter, given extra widgets.
>    GtK+, PyGTK,
>
> Ah, ha. This may be places for me to explore, especially if they have
> extension to canvas and anything to do with IP (img proc).

I'm not sure but since the GtK was originally developed to build the
GIMP there is a fair  likeliehood that it does have some more
advanced IP stuff

> Here's a big question though. Are any of these toolkits free?

So far as I know they are all free with the minor exception of Qt
which is free in certain circumstances

>    FXpy,
>
> FOX binding to Python. Binding?
> What does that mean with respect to the language?

It means it is a Python wrapper around some other language
API - usually C/C++ So you can refer to the original docs and
call the functions from Python. Tkinter is a Python binding for Tk.

> Likely so, how time flies. However, I'm intrigued with some of
> his topics like rubber bands, and moving items on the canvas.
> If Pmw is free and available, it might be worth exercising his
> draw example to see how it works.

Yes PMW is free and still available, at least for Python v2.x
Grayson's example does not use PIL. PIL doesn't do dynamic stuff like
rubber bands though, it only does the actual image
manipulation - actually creating and editing GIF/JPEG images etc
The interaction stuff you need to do using the GUI toolkit.

> To me the documentation here is like my arithmetic analogy,
> but they (say, an author of a book on the subject) left out
> descriptions of both multiplication and division,

Thats because the documentors assume you know the underlying
toolkt and are only really documenting how to use it from Python.
Its like somebody writing a new mathematical notation for addition
or subtraction etc(think Matrix arithmetic say). They define the new
operations b6y allegory to the original math notation but they
assume you know how the basics work already.

> >  option. You must experiment to see how the bits you are interested
> >  in will work together. It's what software engineers do...
>
> This is fine, but I don't want to be a software engineer.

But the task you are doing is software engineering.
Its a bit like deciding that you will build your own house extension
rather than employing a builder. Then you discover you can't
understand the architect's drawings. You need to learn to think/work
like a builder. Similarly to write production level code (which is what
you are doing) you need to think/work like a software engineer. You
are stepping beyond the normal territory of the novice/hobbyist
programmer.

> I have a feeling though there is a lot of loose documentation or
> knowledge imbedded in Python that I'm not yet handy at.
> Dir, Doc, vars, docstrings, Pydoc, help, ...

There is a lot you can do with things like help() and dir() to get
a clue what to look at (or google for) in the documentation. But
you won't always get detail there, simply clues. Often you need to read
the source code to truly understand what's going on. This is one
of the penalties (some say blessings!) of using open source. The
documenration may not be perfect but you can always read the
source - if you have the time!

HTH,

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 




More information about the Tutor mailing list