Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ReducibleGroup

A list of items, each of which can be removed from its own trailing x.

with sc.ReducibleGroup('Files', options=('a.txt', 'b.txt')) as group:
    @group.on_reduce
    def _(item):
        print('removed', item)
ArgumentTypeMeaning
labelstr | PropertyOptional label
optionssequence | PropertyThe items
formatcallable or sequenceLabels
label_visibilitystrSee Inputs

Properties: label, options.

Signals: on_reduce (the dropped item), options.on_change.

The rows are laid out like a MenuButton’s menu. Hovering a row reveals the x; clicking it removes the item from options and emits on_reduce.

The component updates its own options list. Your handler receives the dropped item so it can keep an external list in sync.

@group.on_reduce
def _(item):
    state.files.set([x for x in state.files.get() if x != item])