enthought / enthought/traitsui
File(exists=True) not working as expected?
- Dominant language
- Python
- Stars
- 306
- Forks
- 99
- PR merge metrics
- No merged PRs in 30d
Description
In the following example, I would expect the OK button to be enable after selecting a file.
```python
import traits.api as t
import traitsui.api as tu
from traitsui.menu import OKButton, CancelButton
class Load(t.HasTraits):
filename = t.File(exists=True)
lazy = t.Bool(False)
view = tu.View(
tu.Group('filename', "lazy"),
kind='livemodal',
buttons=[OKButton, CancelButton],
title='Load file')
load_ui = Load()
load_ui.configure_traits()
```
Disable the OK button:

Not setting `exists=True` in the definition of `filename` and specifying the editor instead works:
```python
import traits.api as t
import traitsui.api as tu
from traitsui.file_dialog import FileEditor
from traitsui.menu import OKButton, CancelButton
class Load(t.HasTraits):
filename = t.File()
lazy = t.Bool(False)
view = tu.View(
tu.Group(tu.Item('filename', editor=FileEditor(dialog_style='open')),
"lazy"),
kind='livemodal',
buttons=[OKButton, CancelButton],
title='Load file')
load_ui = Load()
load_ui.configure_traits()
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.