Justin Straube wrote: > As the user enters or removes characters into/from sEnt I would like > for set_info() to set infVar with the correct value. The same as how > IDLE shows the line and column in the lower right corner. > > #### Code Example #### > from time import localtime > from Tkinter import *
# ignore arguments we don't care for in our application def set_info(*args): > x = len(strVar.get()) > infVar.set('Length: %i' % (x)) > > ROOT = Tk() > strVar = StringVar() > infVar = StringVar() # register set_info() to listen for changes written to strVar strVar.trace_variable("w", set_info) > sLab = Label(ROOT, text='String') > sLab.grid(row=0, column=0) > sEnt = Entry(ROOT, textvariable=strVar, width=15) > sEnt.grid(row=0, column=1, columnspan=2) > qBut = Button(ROOT, text='Quit', command=ROOT.quit) > qBut.grid(row=1, column=2, pady=2, padx=2, sticky=E) > iLab = Label(ROOT, textvariable=infVar, width=21, > relief=SUNKEN, anchor=W) > iLab.grid(row=2, column=0, columnspan=3) > > set_info() # example to show what will be displayed. > ROOT.mainloop() > #### End Example #### > > Can anyone point me in the right direction for how to do this? Yes, see above. Peter -- http://mail.python.org/mailman/listinfo/python-list