listbox binding..what is the current selection?

Rick Johnson rantingrickjohnson at
Thu Mar 7 06:49:08 CET 2013

On Wednesday, March 6, 2013 10:38:22 PM UTC-6, Rex Macey wrote:
> I have spent time with the docs, at least with the Python
> v3.3 and tkinter v8.5 (pdf). 

Could you post links to the documents you are reading please? 

Actually when i said "read the docs" i did not mean the offical Python docs on Tkinter (because, IMHO, they are woefully inadequate). I actually meant "read some online tutorials". 

The link i gave you is really more of a reference than a tutorial. It's my go-to reference when i can't remember the behavior of "this" or "that" method, or the spelling of "this" or "that" event sequence. Here is another link that is much more of a tutorial.

> I wish they had more examples. 

Yes me too! Examples speak much louder than mere words. Of course, ONLY if the examples are good examples. Maybe we could combine my ability to write good examples with your ability to judge the noob worthiness of such examples and contribute something positive to this community of ingrates. (please don't mis-interpret the theatrical verbiage, i am, in fact, quite serious)

> My approach is to browse the docs, try a program, fail,
> read the docs, try again.  When I can't figure it out, I
> post.

That's a wise and considerate path. Considerate both for yourself and others.

 The path to enlightenment
The temptation to run and ask somebody for an answer is *VERY*, well,  tempting. The problem is, the more you ask and receive *easy* answers, the more you become dependent on your teacher and not yourself.

Luckily for me (although i was unaware of the benefit at the time) i was oblivious to online help forms when i learned programming; forcing me to be self-reliant when learning. It was just me, some badly written docs, and a text editor. :-)

After lots of trial and error and many a smashed keyboard, i emerged from under my rock with a deep knowledge that i don't believe i could have attained by having someone spoon feed me the answers. 

It seems that when you *DO* find yourself in a wet paper bag that you can't seem to mentally punch yourself out of, and you are forced to get outside input, the last thing you need is people "gift wrapping" answers for you. 

A wise teacher will give you a few clues and then aim you in the correct direction, leaving you to find the exact path to enlightenment. Learning "how to problem solve" is much more important skill than "learning how to solve a problem"; the old "teach a man to fish..." thing.

 Request for your personal experiences:

Since you are new to Tkinter i wonder if you can give some insights into the specific troubles you are encountering. I have long since forgotten most of the troubles i experienced. This would be a good chance to document the issues with the documents.

 Learning GUI's cuts you twice!

Learning GUI's for the first time is very difficult because before you can learn the API of the current GUI library, you must first learn what a "EditText" is, and what a "StaticText" is, and a "ProgressBar", and a "NoteBook", and abstract things like "InputEvents", and how to bind "inputEvents", and "GeometryManagment"; and blah, blah, blah. 

This first step is where most GUI tutorials fail. They try to present both the widgets AND the code to control them simultaneously. It's no wonder the student becomes bewildered!

I believe the first step should involve NO code or even code examples. The first step should be mainly a visual experience combined with interactive delving into the intricacies of what "actions" each widget will expose; using only natural language and visuals to describe the actions. 

But even when GUI tuts follow this wise progression they fail to utilize the power of visualization, and instead focus on pages and pages of boring text.

The second step is learning the actual methods of the widgets and how to link code to actions.

 Morals of My Experience:

Looking back i believe the Tkinter learning path is flawed in to general ways.

1. The official docs are woefully inadequate. 

Which could be solved by writing better documentation, or simply, by linking to a few of the existing good outside documentation. The two links i posted offer the best of both worlds (reference and tutorial[1]) But then, there are all the issues of poor examples around the web. I found myself being thrown into fits of confusion by reading documentations or tutorials that seemed to conflict with one another. 

 """Misleading documentation can be more devastating than missing documentation."""

2. The Tkinter API is asinine, inconsistent, and full of multiplicities. 

I know that sounds unfair but it *IS* true. Yes, Tkinter is one of the simplest Python GUI's to learn, and it has the benefit of being in the Python stdlib, however, it has many issues[2] that should have been resolved long ago, and could be resolved today if i could convince the "keepers of the source" to engage in healthy discussion of these specifics. 

[1] Although the tutorial site has a few confusing examples and fails to cover the new ttk widgets.

[2] Plus, it is missing simple functionalities like "auto-scrollbars". (although this is a direct result of being a slave to the Tk:TCL folks.

More information about the Python-list mailing list