Scrollable Group with a List using TraitsUI
--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 2
--
Chapters
00:00 Scrollable Group With A List Using Traitsui
00:43 Accepted Answer Score 1
01:42 Thank you
--
Full question
https://stackoverflow.com/questions/3343...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #list #scrollable #traitsui
#avk47
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 2
--
Chapters
00:00 Scrollable Group With A List Using Traitsui
00:43 Accepted Answer Score 1
01:42 Thank you
--
Full question
https://stackoverflow.com/questions/3343...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #list #scrollable #traitsui
#avk47
ACCEPTED ANSWER
Score 1
It's the View that should be made scrollable:
from traits.api import HasTraits, List
from traitsui.api import (
View, ListEditor, Group, Item, CheckListEditor, Group
)
class Foo(HasTraits):
my_list = List()
full_list = List()
def _full_list_default(self):
return [str(n) for n in range(10)]
traits_view = View(Group(Item('my_list',
style='custom',
editor=CheckListEditor(name='full_list')),
orientation='vertical'),
scrollable=True,
height=100)
if __name__ == '__main__':
f = Foo()
f.configure_traits()
If you want to embed multiple scrollable views you can do it with Instances and InstanceEditors:
from traits.api import HasTraits, List, Instance
from traitsui.api import (
View, ListEditor, Group,InstanceEditor, Item, CheckListEditor, Group,
VGroup
)
class Foo(HasTraits):
my_list = List()
full_list = List()
def _full_list_default(self):
return [str(n) for n in range(10)]
traits_view = View(Group(Item('my_list',
style='custom',
editor=CheckListEditor(name='full_list')),
orientation='vertical'),
scrollable=True,
height=100)
class FooContainingView(HasTraits):
foo_1 = Instance(Foo)
foo_2 = Instance(Foo)
traits_view = View(
VGroup(
Item('foo_1',
editor=InstanceEditor(),
style='custom',
show_label=False,
),
Item('foo_2',
editor=InstanceEditor(),
style='custom',
show_label=False,
),
),
resizable=True,
)
if __name__ == '__main__':
f = Foo()
fcv = FooContainingView(foo_1=Foo(), foo_2=Foo())
fcv.configure_traits()
...with this result:

