traitsui.editors.date_editor module

A Traits UI editor that wraps a WX calendar panel.

class traitsui.editors.date_editor.CellFormat(**args)[source]

Bases: object

Styling attributes for calendar widget cells.

Encapsulates some common visual attributes to set on the cells of a calendar widget. All attributes default to None, which means that they will not override the existing values of the calendar widget.

The color attributes should be strings representing color names, from the list: red, green, blue, cyan, magenta, yellow, gray, white, darkRed, darkGreen, darkBlue, darkCyan, darkmagenta, darkYellow, darkGray, black, lightGray.

Alternatively, they can be a tuple of (R,G,B) values from 0-255.

bgcolor = None

The background color.

bold = None

Whether to use a bold weight.

fgcolor = None

The text color.

italics = None

Whether to display in an italic style.

underline = None

Whether to underline the text.

class traitsui.editors.date_editor.DateEditor(*args, **traits)[source]

Bases: EditorFactory

Editor factory for date/time editors.

allow_future = Bool(True)

Should users be able to pick future dates when using the CustomEditor?

message = Str("Undefined")

Message to show when Date is None.

months = Int(3)

How many months to show at a time.

multi_select = Bool(False)

True: Must be a List of Dates. False: Must be a Date instance.

on_mixed_select = Enum("toggle", "on", "off", "max_change", "min_change")

When a user multi-selects entries and some of those entries are already selected and some are not, what should be the behavior for the seletion?


  • ‘toggle’: Toggle each day to the opposite of the current state.

  • ‘on’: Always turn them on.

  • ‘off’: Always turn them off.

  • ‘max_change’: Change all to same state, with most days changing. For example 1 selected and 9 not, then they would all get selected.

  • ‘min_change’: Change all to same state, with min days changing. For example 1 selected and 9 not, then they would all get unselected.

padding = Int(5)

How much space to put between the individual months.

selected_style = Instance(

Style used when a date is selected.

shift_to_select = Bool(False)

Does the user have to hold down Shift for the left-click multiselect?

strftime = Str("%B %d %Y (%a)")

The string representation of the date to show. Uses time.strftime format.

view = AView

An optional view to display when a read-only text editor is clicked: