Python Forum
[Tkinter] entry filed sum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] entry filed sum
#2
You would have something like ths:
values= []

def addentry()
     value= StringVar()
     Entry(root, textvariable=value).grid(row=len(entries), column=1)
     values.append(value)
If you want you can keep a handle for each Entry, but once they are created the variable is all you really need. To clear all the entries set all the variables to ''. To sum all the entries loop through the variables, convert the string to a number and add.

Whenever you have a collection of items that can grow arbitrarily think about using a list or a dictionary to hold your collection.
Reply


Messages In This Thread
entry filed sum - by leveex - Apr-04-2020, 09:12 PM
RE: entry filed sum - by deanhystad - Apr-04-2020, 10:04 PM
RE: entry filed sum - by leveex - Apr-05-2020, 01:04 AM
RE: entry filed sum - by deanhystad - Apr-05-2020, 04:24 PM
RE: entry filed sum - by leveex - Apr-05-2020, 05:24 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Transfer Toplevel window entry to root window entry with TKinter HBH 0 4,499 Jan-23-2020, 09:00 PM
Last Post: HBH
  [Tkinter] how to get the entry information using Entry.get() ? SamyPyth 2 3,531 Mar-18-2019, 05:36 PM
Last Post: woooee

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020