DateEntry

Class

class tkcalendar.DateEntry(master=None, **kw)[source]

Bases: tkinter.ttk.Entry

Date selection entry with drop-down calendar.

__init__(master=None, **kw)[source]

Create an entry with a drop-down calendar to select a date.

When the entry looses focus, if the user input is not a valid date, the entry content is reset to the last valid date.

Keyword Options

  • ttk.Entry options:

    class, cursor, style, takefocus, xscrollcommand, exportselection, justify, show, state, textvariable, width.

  • Calendar options: see the documentation.

    The Calendar option cursor has been renamed calendar_cursor to avoid name clashes with the corresponding ttk.Entry option.

cget(key)[source]

Return the resource value for a KEY given as string.

config(cnf={}, **kw)

Configure resources of a widget.

The values for resources are specified as keyword arguments. To get an overview about the allowed keyword arguments call the method keys().

configure(cnf={}, **kw)[source]

Configure resources of a widget.

The values for resources are specified as keyword arguments. To get an overview about the allowed keyword arguments call the method keys().

destroy()[source]

Destroy this and all descendants widgets.

drop_down()[source]

Display or withdraw the drop-down calendar depending on its current state.

get_date()[source]

Return the content of the DateEntry as a datetime.date instance.

keys()[source]

Return a list of all resource names of this widget.

set_date(date)[source]

Set the value of the DateEntry to date.

date can be a datetime.date, a datetime.datetime or a string in locale ‘%x’ format.

state(*args)[source]

Modify or inquire widget state.

Widget state is returned if statespec is None, otherwise it is set according to the statespec flags and then a new state spec is returned indicating which flags were changed. statespec is expected to be a sequence.

Virtual Events

A <<DateEntrySelected>> event is generated each time the user selects a date.