[Tutor] Tkinter Help

Timothy M. Brauch tmbrau00@centre.edu
Wed, 16 May 2001 23:54:51 -0400


I have no experience with Tkinter, but I am planning on learning.  I've
got <http://www.pythonware.com/library/tkinter/introduction/index.htm>
bookmarked, at least.  But, I have what I hope will be a quick question
that I didn't find when I looked through the Intro site.

If I have a dictionary full of keys and values, what would be a simple
way to print those keys and values in a Tkinter widget.  Also, if the
values change, I would need to update the displayed values.

Quick example:

dict={'key_0':0, 'key_1':1, 'key_2':2, 'key_3':3, 'key_4':4, 'key_5':5}

I would like an output of something like:

---------------------------
| key_0 = 0     key_3 = 3 |
| key_1 = 1     key_4 = 4 |
| key_2 = 2     key_5 = 5 |
---------------------------

But, if I do dict['key_0']=6, I would really love it if I could update
it, by calling a function or something, to:

---------------------------
| key_0 = 6     key_3 = 3 |
| key_1 = 1     key_4 = 4 |
| key_2 = 2     key_5 = 5 |
---------------------------

I hope this isn't too hard to do.  Also, are there books that cover
Tkinter, especially for Python, that stick out in anyone's mind?  Hasn't
Alan Gauld written something covering Tkinter recently?

 - Tim