from tkinter import *
import datetime
root =Tk()
root.title("华兴用户注册")
root.geometry("300x200")
def ss():
print("您的姓名:",xm.get())
print("您的性别:",var.get())
print("您的出生年月:",csny.get())
t= datetime.date.today().year-int(csny.get()[:4])
print("您的年龄:",t)
Label(root,text="姓名").grid(row=1,column=1)
xm= Entry(root)
xm.grid(row=1,column=2)
Label(root,text="性别").grid(row=2,column=1)
var=StringVar()
var.set("男")
rdl = Radiobutton(root,text ="男",variable = var,value="男")
rdl.grid(row=2,column=2)
rd2 = Radiobutton(root,text ="女",variable = var,value="女")
rd2.grid(row=2,column=3)
Label(root,text="出生年月").grid(row =3,column=1)
csny= Entry(root)
csny.grid(row=3,column =2)
Button(root,text ="提交",command = ss).grid(row=4,column=2)
root.mainloop()