Trenholmes 0 Newbie Poster

Hi!

First, thanks for taking the time to look at my problem, I really appreciate it. Right now I'm trying to setup a columns of 'cells' made up of labels separated by horizontal panes within a scrolledframe. When i initially run my code everything fills in fine. However, when I try to add new labels to the bottom of the columns the new labels don't appear. If i adjust the sashes on any of my panes the labels will suddenly populate. Obviously, I'd like the columns to automatically update without having to hack sash movements to get them to appear. Below you'll find a sample of code that behaves the way I've described. When you run the code it will display several columns. If you type 'z' on your keyboard it will generate new labels. You'll only be able to see those labels once you move any sash. I've tried this with the pack and grid geometry manager and can't get it working. =(

Thanks again for any help you can provide!

from Tkinter import *
import Pmw

def test(k):
    global x
    for c in range(0,10):
        for d in range(0,1):
            l = Label(k[c],text='wow! %d' % d)
            x=x+d+1
            l.grid(row=x, column=0)
    print 'done'
    return

root = Tk()

sf = Pmw.ScrolledFrame(root, borderframe=FLAT, vertflex='fixed') 
pane = PanedWindow(sf.interior(), orient=HORIZONTAL,
                                sashrelief=RAISED, sashpad=0, bg='white',
                                borderwidth=0, sashwidth=3, opaqueresize=True,
                                handlepad=0,handlesize=0, showhandle=0,
                                relief=FLAT)
sf.pack(fill=BOTH, expand=YES)
pane.grid()
k=[]
x=0

for c in range(0,10):
    k.append(Frame(pane))
    k[c].grid(row=0, column=0)
    pane.add(k[c])
    pane.paneconfig(k[c], minsize=10)
    for d in range(0,25):
        l = Label(k[c],text='wow! %d' % d)
        l.grid(row=d, column=0)
        x=d

root.bind('z', lambda e: test(k))

root.mainloop()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.