enthought / enthought/traitsui

Stretchy tabular editor makes last column way too wide

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

Description

If `stretch_last_section=True` (the default) for the `TabularEditor`, the resulting table has a final column which is exceedingly wide:

### Example:

```python
from traits.api import *
from traitsui.api import *
from traitsui.tabular_adapter import TabularAdapter

class Person(HasTraits):
name = Str
age = Int

class PersonAdapter(TabularAdapter):
columns = [('Name', 'name'), ('Age', 'age')]

class People(HasTraits):
persons = List(Instance(Person))

def _persons_default(self):
return [Person(name=f'Bob-{i}', age=i) for i in range(32)]

traits_view = View(
UItem(
'persons',
editor=TabularEditor(
adapter=PersonAdapter(),
stretch_last_section=True,
),
),
width=300,
resizable=True,
)

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

### Result with `stretch_last_section=True`

![image](https://user-images.githubusercontent.com/1588456/66006757-634fee00-e475-11e9-8999-cc027b10412f.png)

### Result with `stretch_last_section=False`

![image](https://user-images.githubusercontent.com/1588456/66006811-96927d00-e475-11e9-834d-bb0938f7ba94.png)

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.