enthought / enthought/traitsui

issue with Time_editor_demo.py and Qt backend

Open
#1,784 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
306
Forks
99
PR merge metrics
No merged PRs in 30d

Description

Hello,

Using Time_editor_demo.py in demo/Advanced, I try to display time in format %H:%M:%S.

The readonly item display time correctly, but not the editable one: it displays only "12:30", not "12:30:15"

I use qt4 backend for now (because chaco does not yet work with wx) but I don't have this issue for this example
with the wx backend.

Thanks in advance.

Regards

import datetime

from traits.api import HasTraits, Time
from traitsui.api import View, Item, TimeEditor

class TimeEditorDemo(HasTraits):
"""Demo class."""

time = Time(datetime.time(12, 30, 15))

traits_view = View(
Item('time',
label='Simple Editor',
style='simple',
editor=TimeEditor(strftime='%H:%M:%S')),
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)

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

demo = TimeEditorDemo()

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

Debian x86_64, Python 3.9.2, traits source from git repo

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.