MembersListSelector
Introduction
Members List Selector widget allows to display list of users with roles.
Function signature
members_list_selector = MembersListSelector(
users=members,
multiple=True,
widget_id=None,
)Parameters
users
List[UserInfo]
Supervisely UserInfo objects
multiple
bool
Enable multiple users selection
widget_id
str
ID of the widget
users
List of UserInfo objects.
type: List[UserInfo]
multiple
If True then multiple users can be selected. Otherwise, only one user can be selected.
type: bool
default False
widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
set()
Set members to widget.
get_selected_members()
Return list of selected members.
select_all()
Select all members.
deselect_all()
Deselect all members.
select()
Select members by names.
deselect()
Deselect members by names.
set_multiple()
Set multiple flag.
get_all_members()
Return list of all members.
@selection_changed
Callback triggers when selection is changed.
Mini App Example
You can find this example in our Github repository:
supervisely-ecosystem/ui-widgets-demos/selection/018_members_list_selector/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Get list of team members from API
Initialize MembersListSelector widget and Text widget for displaying selected members count
MembersListSelector widget and Text widget for displaying selected members countCreate app layout
Prepare a layout for app using Card widget with the content parameter and place widget that we've just created into the Container widget.
Create app using layout
Create an app object with layout parameter.
Add functions to control widgets from python code
Last updated
Was this helpful?