Ejemplo n.º 1
0
def time_editor():
    """ Factory function that returns a Time editor for editing Time values.
    """
    global TimeEditor

    if TimeEditor is None:
        from traitsui.api import TimeEditor
        TimeEditor = TimeEditor()

    return TimeEditor
Ejemplo n.º 2
0
class TimeEditorDemo(HasTraits):
    """ Demo class. """
    time = Time(datetime.time(12, 0, 0))
    view = View(
        Item('time', label='Simple Editor'),
        Item(
            'time',
            label='Readonly Editor',
            style='readonly',
            # Show 24-hour mode instead of default 12 hour.
            editor=TimeEditor(strftime='%H:%M:%S')),
        resizable=True)

    def _time_changed(self):
        """ Print each time the time value is changed in the editor. """
        print(self.time)
Ejemplo n.º 3
0
def time_editor():
    """ Factory function that returns a Time editor for editing Time values.
    """
    from traitsui.api import TimeEditor
    return TimeEditor()