def get_data_now(self):
def print_sel(e):
print(self.cal.get_date())
return self.cal.get_date()
self.cal.bind("<<DateEntrySelected>>", print_sel)
import tkinter as tk
from tkinter import ttk
import datetime
from tkcalendar import Calendar, DateEntry
class Date_Picker:
def __init__(self, master):
self.root = master
self.label = ttk.Label(self.root, text='Select date').pack(side='left')
self.cal = DateEntry(self.root, width=12, background='darkblue',
foreground='white', borderwidth=2, date_pattern='dd/mm/YYYY')
self.cal.pack(side='left')
def get_data_now(self):
def print_sel(e):
print(self.cal.get_date())
return self.cal.get_date()
self.cal.bind("<<DateEntrySelected>>", print_sel)
def show(self):
print('Выбраная дата: ', self.cal.get())
return self.cal.get()
root = tk.Tk()
s = ttk.Style(root)
s.theme_use('clam')
cal_form = Date_Picker(root)
cal_to = Date_Picker(root)
root.mainloop()
from tkinter import *
from tkcalendar import DateEntry
root = Tk()
def handler(*args):
# set data in datetime.date format
variable = StringVar()
entry_1 = DateEntry(root, date_pattern='dd/mm/YYYY', textvariable = variable)
entry_2 = DateEntry(root, date_pattern='dd/mm/YYYY')
variable.trace_add("write", handler)
entry_1.pack()
entry_2.pack()
root.mainloop()