enthought / enthought/traitsui

Checkbox for ListEditor use_notebook context menu raises TypeError

Open
#476 0 comments 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
Python
Stars
306
Forks
99
PR merge metrics
No merged PRs in 30d

Description

(version 6.0.0)

When using `ListEditor` if `use_notebook` and `show_notebook_menu` are both set to `True`, then the checkboxes in the context menu for the tabs do not work properly because of insufficient arguments to a lambda.

Small example:

```
from traits.api import *
from traitsui.api import *

class NumberHolder(HasTraits):
numbers = List(Int)

def _numbers_default(self):
import numpy as np
return list(np.random.randint(-10,11,size=5))

class NumberHolderTabs(HasTraits):

number_holder_tabs = List(NumberHolder)

def _number_holder_tabs_default(self):
return [NumberHolder() for _ in range(3)]

def default_traits_view(self):
return View(
UItem('number_holder_tabs',
style='custom',
editor=ListEditor(use_notebook=True, show_notebook_menu=True)
),
)

if __name__ == '__main__':
NumberHolderTabs().configure_traits()
```

In the above, right-clicking a tab and unchecking a menu item will throw the error:
> `TypeError: () takes at least 1 argument (0 given)`

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.