File: Date_range_editor_demo.py

package info (click to toggle)
python-traitsui 6.1.3-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 11,252 kB
  • sloc: python: 44,765; makefile: 117
file content (36 lines) | stat: -rw-r--r-- 1,001 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#  Copyright (c) 2007-2009, Enthought, Inc.
#  License: BSD Style.

"""
A Traits UI editor that wraps a Qt calendar panel.
"""
from __future__ import absolute_import, print_function

from traits.api import HasTraits, Date, Tuple
from traitsui.api import View, Item, DateRangeEditor, Group


class DateRangeEditorDemo(HasTraits):
    """ Demo class to show DateRangeEditor. """
    date_range = Tuple(Date, Date)

    view = View(
                Group(Item('date_range',
                           editor=DateRangeEditor(),
                           style='custom',
                           label='Date range'),
                      label='Date range'),
                resizable=True)

    def _date_range_changed(self):
        print(self.date_range)


#-- Set Up The Demo ------------------------------------------------------

demo = DateRangeEditorDemo()

if __name__ == "__main__":
    demo.configure_traits()

#-- eof -----------------------------------------------------------------------