3.3.7. Dropdown¶
The Dropdown control is often used to select a specific value among the multiple attribute options of an object.
-
dropdown_object.
set_options
(*options)¶ Description: Sets the content of the dropdown box, which is a list of strings. The number of items in the list is the number of dropdown box options. 参数: *args (string) – Options in the dropdown box 返回: None Example: my_Dropdown.set_options('RoboMaser EP', 'People')
Example description: There are two options in the dropdown box, RoboMaster EP
andPeople
-
dropdown_object.
set_background_color
(r, g, b, a)¶ Description: Sets the background color of the selected item in the dropdown box
参数: - r (int) – The r value of background color, whose range is [0, 255]
- g (int) – The g value of the background color, whose range is [0, 255]
- b (int) – The b value of the background color, whose range is [0, 255]
- a (int) – The transparency of the background color, whose range is [0, 255]
返回: None
Example: my_DropDown.set_background_color(200, 200, 200, 230)
Example description: Set the rgb value of the background color of selected items in the dropdown box to (200, 200, 200) and the transparency to 230
-
dropdown_object.
set_arrow_color
(r, g, b, a)¶ Description: Sets the color of the selection arrow in the dropdown box
参数: - r (int) – The r value of arrow color, whose range is [0, 255]
- g (int) – The g value of arrow color, whose range is [0, 255]
- b (int) – The b value of arrow color, whose range is [0, 255]
- a (int) – The transparency of arrow color, whose range is [0, 255]
返回: None
Example: my_Dropdown.set_arrow_color(120, 120, 120, 200)
Example description: Set the rgb value of the color of the selection arrow in the dropdown box to (120, 120, 120) and the transparency to 200
-
dropdown_object.
set_item_background_color
(r, g, b, a)¶ Description: Sets the background color of unselected items in the dropdown box
参数: - r (int) – The r value of background color, whose range is [0, 255]
- g (int) – The g value of the background color, whose range is [0, 255]
- b (int) – The b value of the background color, whose range is [0, 255]
- a (int) – The transparency of the background color, whose range is [0, 255]
返回: None
Example: my_DropDown.set_item_background_color(200, 200, 200, 230)
Example description: Set the rgb value of the background color of unselected items in the dropdown box to (200, 200, 200) and the transparency to 230
-
dropdown_object.
set_item_checkmark_color
(r, g, b, a)¶ Description: Sets the color of the selection icon in the dropdown box
参数: - r (int) – The r value of checkmark color, whose range is [0, 255]
- g (int) – The g value of checkmark color, whose range is [0, 255]
- b (int) – The b value of checkmark color, whose range is [0, 255]
- a (int) – The transparency of checkmark color, whose range is [0, 255]
返回: None
Example: my_DropDown.set_item_checkmark_color(200, 200, 200, 230)
Example description: Set the rgb value of the checkmark color in the dropdown box to (200, 200, 200) and the transparency to 230