enthought / enthought/traitsui

ButtonEditor is not correctly initialized when the view is opened

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

Description

I am opening an issue because it seems that this is a bug. I use a `ButtonEditor` with `style="radio"` for a `Bool` trait. When the view oipen, the button does not appear like clicked, even if the trait is set to True.

Here is a code to reproduce this issue:

```
from traits.api import Bool, HasStrictTraits
from traitsui.api import ButtonEditor, UItem, View

class BoolWithButton(HasStrictTraits):

bool_trait = Bool(True)

def default_traits_view(self):
return View(
UItem(
"bool_trait",
style="custom",
editor=ButtonEditor(value=True, style="radio"),
),
width=300,
height=300,
)

if __name__ == "__main__":
bb = BoolWithButton()
bb.configure_traits()
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the provided BoolWithButton reproduction with TraitsUI and inspect how ButtonEditor(value=True, style="radio") is initialized when the view opens. Trace the editor's connection to the Bool trait; done means the radio-style button appears selected when bool_trait starts as True, with a regression test covering the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.