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
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)
def time_editor(): """ Factory function that returns a Time editor for editing Time values. """ from traitsui.api import TimeEditor return TimeEditor()