无法将文本添加到XML文件,没有错误

I've been working on a simple python program to add 3 SubElements to a xml file. I keep running into an error I'm not quite sure how to fix.

TypeError: cannot serialize <tkinter.StringVar object at 0x0347CAD8> (type StringVar)

这是python代码:

import tkinter as tk
from tkinter import ttk
import xml.etree.ElementTree as et


#Tkinter
root = tk.Tk()
root.title("XML")
root.geometry("300x200")


frame = ttk.Frame(root, padding="10 10 10 10")
frame.pack()


#Button Action Adding XML to Mod7XML.xml
def click_button1():
    tree = et.parse('Mod7XML.xml')
    rootXML = tree.getroot()

    countryXML = et.SubElement(rootXML, 'country')

    nameXML = et.SubElement(countryXML, 'name')
    nameXML.text=name1

    populationXML = et.SubElement(countryXML, 'population')
    populationXML.text=population1

    continentXML = et.SubElement(countryXML, 'continent')
    continentXML.text=continent1

    tree.write('Mod7XML.xml')


#Label1
label1 = ttk.Label(frame, text="name")
label1.pack()

#TextEntry1
name1 = tk.StringVar()
name1Entry = ttk.Entry(frame, width=25, textvariable=name1)
name1Entry.pack()

#Label2
label2 = ttk.Label(frame, text="population")
label2.pack()

#TextEntry2
population1 = tk.StringVar()
population1Entry = ttk.Entry(frame, width=25, textvariable=population1)
population1Entry.pack()

#Label3
label3 = ttk.Label(frame, text="continent")
label3.pack()

#TextEntry3
continent1 = tk.StringVar()
continent1Entry = ttk.Entry(frame, width=25, textvariable=continent1)
continent1Entry.pack()

#Button1
button1 = ttk.Button(frame, text="Add XML data", command=click_button1)
button1.pack()

root.mainloop()

和我的xml文件:

<nations>
     <country>
          <name>France</name>
          <population>66.99</population>
          <continent>Europe</continent>
     </country>
</nations>

When I run my python program, it changes the xml line 7, the last line, to <country><name>, instead of adding the three sub elements.