[Tutor] Tkinter event handler

Alan Gauld alan.gauld at btinternet.com
Fri Jan 13 09:45:20 CET 2012


On 13/01/12 03:44, Chase Franklin wrote:

> I'd like to include the class name so that it becomes:
> 001_Jan_12_2012_CLASSNAME.org
>
> So I have a simple Tk window that is populated by a list of class names.

What is a "Simple Tk window"?
There is no such widget. So what is the window using to list the names?
Is it a label?
a text widget? or a List entry woidget(which would seem the most logical)

> 1. Class One
> 2. Class Two
> 3. Class Three
>
> Idealy, at this prompt I'd like to simply press the corresponding
> number and be on to emacs with the Class Name added to the file name

When you say press the "number" do you mean you want the user to point 
at the digit part of the line?
Why not just have them click on the line itself?
That's what a list entry does by default.

You can then select as much or as little of the seleced text to put in 
your filename.

> as above. I know how to hard code this for each keypress, but is there
> a way to create the events dynamically so that when the list changes
> the keys follow suit? I hope I've been clear enough, thanks!

I don;t undertsamd this at all.
Tk events are all created dynamically but they have nothing to do ewith 
the content of the list.

I think you need to show us some code. At the moment its not at all 
clear(to me) what you are trying to do.

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



More information about the Tutor mailing list