Tkinter: manipulating data in 'entry' widgets.

Neil Cerutti cerutti at together.net
Mon Jan 29 10:40:45 EST 2001


jerry keeney posted:
>Hopefully this is'nt a repeat of an oft discussed
>item:
>
>I have a Tkinter program with 3 entry widgets.  I
>would like to take the numbers entered in the first
>two, total them and display them in the 3rd (or even
>just as a label).
>
>I believe the idea is to capture the entry with a
>DoubleVar, but beyond that I'm not sure.  

I don't think you need a special Var if you use polling. Call a
method of the parent window that also calls itself using the
.after method.


  def pollEntries(self):
    if self.entry1.get() || self.entry2.get():
      self.updateEntries()
    self.after(250, self.pollEntries()

This assumes your window object has two Entry widgets called
entry1 and entry2, you started the ball rolling by calling
pollEntries, and you provide an updateEntries routine that does
that presumably write to entry3.

-- 
Neil Cerutti <cerutti at together.net>



More information about the Python-list mailing list