[Tutor] Question related to Tkinker

Peter Otten __peter__ at web.de
Sun Jul 24 10:45:41 CEST 2011


Emeka wrote:

> for i,cha in enumerate(wordi):
> 
>     label = Label(root,  image=photoimage, text = cha)
>     label.grid(row=1, column=i, columnspan=1, rowspan=1,sticky=W+E+N+S,
> padx=0, pady=1)
>     label1 = Label(root,  image=IMAGE)
> 
> I used grid ... Though I used labels, I was dealing only on character
> level.
> So for word like "JAVA" . I will have  a row with four cells and each
> filled with the individual character so that I could manipulate them
> individually.
> 
> Now, if I late have "ORACLE" in level 2.. I would want to use to write it
> in the same row as above however with six cells.

Keep the labels in a list and ensure that there are enough labels (the list 
is long enough) before you configure them to show the characters. 

Use the grid_forget() method to hide extra labels if the current word is 
shorter than a previous one.



More information about the Tutor mailing list