[Tkinter-discuss] Filling a series of tk.Label
Iain Day
iain at day-online.org.uk.invalid
Mon Mar 16 22:50:24 CET 2009
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
More information about the Tkinter-discuss
mailing list