[Tkinter] Changing the text of labels in a grid

Carles Sadurní Anguita isard at localhost.localdomain
Fri Aug 25 07:37:53 EDT 2000


Hello,

Thanks to comp.lang.python's people I've created a grid of labels and I know
where the user clicked. I want to change the text of the clicked label.

I read that this can be done (for a single label) with

v = StrinVar()
lbl = Label(master, textvariable=v).grid()
v.set("hi, folks!")

But, how can I change the text of the label that is in (row, column)? Is it
possible to do textvariable = v[r][c] (where v is a list of lists)? Python
complains if I type 

v[r][c].set("hi!")

because v is not a StringVar. Can I create a list of lists of StringVars? Is
there any simpler way?

Thanks again.

-- 
------------------------------------------------------------------------
Carles Sadurní Anguita    |   no había que cumplir promesas,
                          |   el cansancio era de placer,
Quita _mira_la_firma para |   las lágrimas eran de risas...
responder.                |   y parece que aún fue ayer.
                          |           Los Suaves
------------------------------------------------------------------------



More information about the Python-list mailing list