dropdown add and remove
to add you can
droplist =
droplist.append({'label':'hello','value':1})
droplist.append({'label':'hello2','value':2})
self.getSibling('Dropdown').props.options = droplist
The syntax to remove is
dropdown = self.getSibling('Dropdown')
if "option_you_want_to_remove" in dropdown.props.options:
dropdown.props.options.remove("option_you_want_to_remove")
I can not figure how to option_you_want_to_remove format and how would
you know what option_you_want_to_remove would be
Hi, Donald. Please see Wiki - how to post code on this forum and hit the pencil icon to edit your post. Otherwise we don't know if it's indented properly.
OK. You haven't explained what's wrong with my answer and you don't seem to be interested in contributing on the site. I don't think I can help further.
first I thought you were an AI type auto responder. Second I was looking on what the syntax was for the remove command. It would seem you would need to grab the dropdown list entries before you would know the string to look for. I have accessed the manual but as normal it is vague and does not cover all the options with examples.
So if you append the dropdown with
droplist.append({'label':'hello','value':1})
and use the comand
dropdown.props.options.remove("option_you_want_to_remove")
how do you know what should replace "option_you_want_to_remove"
with out scanning the list to begin with cause It is not using input command and your example does not use the remove command
How are you getting the 'option_you_want_to_remove', is this just the selected option in the dropdown or is it being populated from somewhere else?
Assuming you know what the 'option_you_want_to_remove' is you can traverse the array, find the index (if the option exists) and then use the .pop(index) function to remove that instance. Python Arrays is a good resource for array manipulation.
As Transistor mentioned, please post code on the forums in the proper format so we can easily follow it.
@Donald_Dahlman : Perhaps you should open a support ticket, so someone gets paid to help you. This forum is full of volunteers who don't have to put up with your [expletive].