I am interested in how to customize the given entry widget by additionally opening up another entry widget (here phone number) and save the input depending on if another entry is added or not. This is what I have so far:
import tkinter as tk
root=tk.Tk()
root.geometry("600x400")
name_var=tk.StringVar()
surname_var=tk.StringVar()
def getInput():
name=name_var.get()
surname=surname_var.get()
print("The name is : " + name)
print("The Surname is : " + surname)
name_var.set("")
surname_var.set("")
def addEntry():
phone_label = tk.Label(root, text = 'Phone', font=('calibre',10, 'bold'))
phone_entry = tk.Entry(root, font=('calibre',10,'normal'))
phone_label.grid(row=3,column=0)
phone_entry.grid(row=3,column=1)
name_label = tk.Label(root, text = 'Name', font=('calibre',10, 'bold'))
name_entry = tk.Entry(root,textvariable = name_var, font=('calibre',10,'normal'))
surname_label = tk.Label(root, text = 'Surname', font = ('calibre',10,'bold'))
surname_entry=tk.Entry(root, textvariable = surname_var, font = ('calibre',10,'normal'), show = '*')
name_label.grid(row=0,column=0)
name_entry.grid(row=0,column=1)
surname_label.grid(row=1,column=0)
surname_entry.grid(row=1,column=1)
save_btn=tk.Button(root,text = 'Save', command = getInput)
save_btn.grid(row=5,column=0)
add_btn=tk.Button(root,text = 'Add Info', command = addEntry)
add_btn.grid(row=5,column=1)
root.mainloop()
How can I define another function for saving the additional phone input and save it using one 'save' button? Thanks a lot