Selection_List Widget. adding items to list #2973
-
I have a directory /DRAFTS with in that directory there are sub-directories with files that will need reviewed. Once reviewed they will be moved to a PROOFED directory. I'm trying to use the selection_list widget to diplay the list of DRAFT files. that way the user can select the ones that have been proofed and can be moved to the PROOFED path. I can use glob to list the contents of the /DRAFTS directory and get them into a list but I can't figure out how to use that list to populate the Selection_List on loading the APP. Here is my static list which displays correctly
Using a Static LIST variable
Results of run
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
yield SelectionList[int](*[Selection(file_name, file_no) for file_name, file_no in LIST]) (do double-check, I typed that off the top of my had and it's late on in the afternoon....) You can see this in passing in the documentation for |
Beta Was this translation helpful? Give feedback.
SelectionList
takes the selections as positional arguments; so to do what you want you'll want to use the usual Python thing of "unrolling" the list with*
. Assuming you'd want to turn them into actualSelection
instances too, you'll want something like this:(do double-check, I typed that off the top of my had and it's late on in the afternoon....)
You can see this in passing in the documentation for
SelectionList
, in the typing section.