Combine two two selected numbers in a combobox to create a date (day and month)

  combobox, python, python-3.x, string, tkinter

I have two comboboxes named Day and Mounth. By selecting the numbers of both, I would like to merge them (day + month) into a single element called "date", in order to get a date. They must be divided by a period ".", For example 26.12

day = StringVar()
month = StringVar()

#Day
combo_day = ttk.Combobox(root, font=("Calibri", 11), width=6, textvariable=day)
combo_day['values'] = ("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31") 
combo_day.place(x=15, y=150)
combo_day.set("Day")

#Month
combo_month = ttk.Combobox(root, font=("Calibri", 11), width=6, textvariable=month)
combo_month['values'] = ("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12") 
combo_month.place(x=105, y=150)
combo_month.set("Month")

date = "day" + "." + "month"

Source: Python Questions

LEAVE A COMMENT