'Update entry in tkinter

I want to print my entry when button is pressed in tkinter. Here is the code for hire() function:

def hire():
    current_time = datetime.now()
    time = current_time.strftime("%H:%M:%S")
    data = Tk()
    data.geometry("200x160")
    name_label = Label(data, text = "Name: ").place(x = 0, y = 0)
    name_entry = StringVar()
    name = Entry(data, textvariable = name_entry)
    name.place(x = 60, y = 0)
    
    surname_label = Label(data, text = "Surname: ").place(x = 0, y = 20)
    surname_entry = StringVar()
    surname = Entry(data, textvariable = surname_entry)
    surname.place(x = 60, y = 20)
    
    cnp_label = Label(data, text = "CNP: ").place(x = 0, y = 40)
    cnp_entry = StringVar()
    cnp = Entry(data, textvariable = cnp_entry)
    cnp.place(x = 60, y = 40)
    
    salary_label = Label(data, text = "Salary: ").place(x = 0, y = 60)
    salary_entry = StringVar()
    salary = Entry(data, textvariable = salary_entry)
    salary.place(x = 60, y = 60)
  
    info_employee = [name.get(), surname.get(), salary.get(), cnp.get()]
    info_employee.append(str(date.today()))
    info_employee.append(str(time))
    data.mainloop()
    
    submit = Button(data, text="Submit", command = lambda: submit_info(info))
    submit.place(x = 60, y = 100)

And here is the code for the function commanded with the button

def submit_info(info):
    if  all(element != '' for element in info_employee):
        cursor = car_dealer.cursor()
        add_employee = "INSERT INTO `employee`(`Name`, `Surname`, `CNP`, `Salary`, `Data`, `Time`) VALUES (%s, %s, %s, %s, %s, %s)"
        cursor.execute(add_employee, info_employee)
        car_dealer.commit()
        car_dealer.close()

The first 4 fields still empty, how can I solve this ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source