Jan-22-2020, 06:54 PM
(This post was last modified: Jan-22-2020, 06:54 PM by LagratteCchouette.)
Hello,
I want to recover the date selected in the calendar which opens with a single click and as soon as I confirm with the OK button I can insert it in the "entry_date" field.
i don't see how to do it, could you please help me.
thank you very much in advance.
but I have an error message on line 30, however I recover my function "result_selected()"
I want to recover the date selected in the calendar which opens with a single click and as soon as I confirm with the OK button I can insert it in the "entry_date" field.
i don't see how to do it, could you please help me.
thank you very much in advance.
but I have an error message on line 30, however I recover my function "result_selected()"
Quote: entry_date = Entry(root,result_select())
NameError: name 'result_select' is not defined
# coding:utf-8 from tkinter import * try: import tkinter as tk from tkinter import ttk except ImportError: import tkinter as tk import ttk from tkcalendar import Calendar, DateEntry def calendar1(event): def result_select(): return cal.selection_get() top = tk.Toplevel(root) cal = Calendar(top, font="Arial 9", selectmode='day', locale='en_US', cursor="hand1", year=2020, month=2, day=5) cal.pack(fill="both", expand=True) ttk.Button(top, text="ok", command=result_select).pack() # Window root = Tk() root.geometry("500x500") entry_date_label = Label(root, text="Entry date simple click").pack() entry_date = Entry(root,result_select()) entry_date.pack() # Active calendar entry_date.bind('<Button-1>', calendar1) # simple clic root.mainloop()