[Python] tkinter loop for getting user input in entry boxes

Discussão em 'Python' iniciado por Stack, Maio 2, 2025.

  1. Stack

    Stack Membro Participativo

    I have a tkinter window that has a list of entry boxes. I need the user to update the entry boxes, then loop through each entry to make an API PUT call for each entry. I'm unsure of how to do this. I've tried using the append method but I get an attribute error saying "AttributeError: 'str' object has no attribute 'append'". I thought maybe if I store each user entry in a list that would work.

    [​IMG]

    I'm attaching a screenshot of the boxes (it's for due dates and due times for an application I'm building).

    Here is the code that I have currently. However, as I have it written, it grabs the last line of both date and time, and applies it to every entry when the API call is made. What am I doing wrong?

    DD = []
    DT = []

    date = entry1.get()
    date.append(DD)
    time = entry2.get()
    time.append(DT)

    for i in assignment:
    update = i.edit(assignment={'due_at': date + 'T' + time + 'Z'})
    update
    print(date + ' ' + time)
    print(update)

    Continue reading...

Compartilhe esta Página