3.3.7. Dropdown¶
Dropdown 控件通常用於在某個對象的多個屬性選項中,選中某個特定值
-
dropdown_object.
set_options
(*options)¶ 描述: 設置下拉框中的內容,輸入為字符串列表,列表中元素個數為下拉框選項個數 參數: *args (string) – 下拉框中的選項內容 傳回: 無 示例: my_Dropdown.set_options('RoboMaser EP', 'People')
示例說明: 下拉框中有兩個選項,分別為 RoboMaster EP
與People
-
dropdown_object.
set_background_color
(r, g, b, a)¶ 描述: 設置下拉框中選中的條目的背景色
參數: - r (int) – 背景顏色的 r 值,範圍為[0, 255]
- g (int) – 背景顏色的 g 值,範圍為[0, 255]
- b (int) – 背景顏色的 b 值,範圍為[0, 255]
- a (int) – 背景顏色的透明度,範圍為[0, 255]
傳回: 無
示例: my_DropDown.set_background_color(200, 200, 200, 230)
示例說明: 設置下拉框中選中的條目的背景色的 rgb 值為(200, 200, 200) ,透明度為 230
-
dropdown_object.
set_arrow_color
(r, g, b, a)¶ 描述: 設置下拉框選箭頭的顏色
參數: - r (int) – 箭頭顏色的 r 值,範圍為[0, 255]
- g (int) – 箭頭顏色的 g 值,範圍為[0, 255]
- b (int) – 箭頭顏色的 b 值,範圍為[0, 255]
- a (int) – 箭頭顏色的透明度,範圍為[0, 255]
傳回: 無
示例: my_Dropdown.set_arrow_color(120, 120, 120, 200)
示例說明: 設置下拉框選中箭頭顏色的 rgb 值為(120, 120, 120),透明度為 200
-
dropdown_object.
set_item_background_color
(r, g, b, a)¶ 描述: 設置下拉框中未被選擇的條目的背景色
參數: - r (int) – 背景顏色的 r 值,範圍為[0, 255]
- g (int) – 背景顏色的 g 值,範圍為[0, 255]
- b (int) – 背景顏色的 b 值,範圍為[0, 255]
- a (int) – 背景顏色的透明度,範圍為[0, 255]
傳回: 無
示例: my_DropDown.set_item_background_color(200, 200, 200, 230)
示例說明: 設置下拉框中未被選擇的條目的背景色的 rgb 值為(200, 200, 200) ,透明度為 230
-
dropdown_object.
set_item_checkmark_color
(r, g, b, a)¶ 描述: 設置下拉框中選中圖標的顏色
參數: - r (int) – checkmark顏色的 r 值,範圍為[0, 255]
- g (int) – checkmark顏色的 g 值,範圍為[0, 255]
- b (int) – checkmark顏色的 b 值,範圍為[0, 255]
- a (int) – checkmark 顏色的透明度,範圍為[0, 255]
傳回: 無
示例: my_DropDown.set_item_checkmark_color(200, 200, 200, 230)
示例說明: 設置下拉框中 checkmark 顏色的 rgb 值為(200, 200, 200) ,透明度為 230