Python Forum
tkinter only storing last element/data from entry widget
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
tkinter only storing last element/data from entry widget
#2
I think this is the problem
    for stuff in dueDate:
        entry = tk.Entry(assignmentName)
        global entry1
        entry1 = tk.Entry(dateDue)
        global entry2
        entry2 = tk.Entry(timeDue)
global entry1 and global entry2 indicate that you want entry1 and entry2 to be global variables. Why? If there is multiple stuff in dueDate, entry1 and entry2 are reassigned each time though the loop. You might create 10 entry1 and 10 entry2, but the global variable only references the last.
This has nothing to do with tkinter. You would have the same problem with any variable that you assign in a loop. If a loop produces multiple results, and you want all the results, save them in a list.
Reply


Messages In This Thread
RE: tkinter only storing last element/data from entry widget - by deanhystad - Today, 02:24 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  LLM data I/O - for storing notes Alkanet 0 378 Dec-19-2024, 09:08 AM
Last Post: Alkanet
  Storing data in readable place user_404_lost_and_found 4 1,482 Jul-22-2024, 06:14 AM
Last Post: Pedroski55
  how to open a popup window in tkinter with entry,label and button lunacy90 1 3,419 Sep-01-2023, 12:07 AM
Last Post: lunacy90
  Plot a pandas data fram via pyqtgraph with an modul import and qt designer widget Nietzsche 0 1,548 May-29-2023, 02:42 PM
Last Post: Nietzsche
Question Inserting Numerical Value to the Element in Optionlist and Printing it into Entry drbilgehanbakirhan 1 1,579 Jan-30-2023, 05:16 AM
Last Post: deanhystad
  Tkinter Entry size limit vman44 3 11,563 Dec-22-2022, 06:58 AM
Last Post: vman44
  Auto increament in Entry field. in tkinter GUI cybertooth 7 6,334 Sep-17-2021, 07:56 AM
Last Post: cybertooth
  Help with storing temp data for each day then recording min/max in app. trthskr4 3 3,475 Sep-10-2021, 10:51 PM
Last Post: trthskr4
  Problem with storing data in SQLAlchemy db marcello86 1 3,328 Aug-31-2020, 09:44 PM
Last Post: Larz60+
  data from multiple Entry widgets beevee 13 6,995 Aug-16-2020, 12:31 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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