Hi,

I've written a short program which is supposed to populate a table constructed from tk.Label widgets. It does this by looping over the rows. Unfortunately, it only seems to populate the final row. What am I doing wrong?

The code is:

def updatedata():
    updatetime.delete(0, tk.END)
    for i in range(len(machines)):
        print machines[i]
        status = sshshowstat(machines[i])

        for j in range(len(status)):
            param, value = status[j].split(': ')

            for k in range(len(variables)):
                if re.match(variables[k], param) is None:
                    continue
                else:
#                    print i, value
                    if value in ('Acquiring', 'Regulated'):
systemdata[i][k].config(text=value, foreground='green')
                    elif value in ('Not Reg.'):
systemdata[i][k].config(text=value, foreground='red')
                    else:
                        systemdata[i][k].config(text=value)


tk.Button(root, text="Update Table Data", command=updatedata).grid(row=len(machines)+1, column=len(variables), sticky=tk.S)



Thanks,

Iain

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to