CheckBox

Inherits: Button < BaseButton < Control < CanvasItem < Node < Object

二元选择(有或无)用户界面小部件。另请参阅CheckButton

描述

复选框让用户做出二元选择,即在两个可能的选项中只选择一个。它在功能上类似于CheckButton,但外观不同。为了遵循用户体验,建议在切换它对某些东西没有直接影响时使用CheckBox。例如,当切换它只会在确认按钮被按下时做一些事情时,使用它。

参阅BaseButton,它包含了与该节点相关的常规属性和方法。

属性

TextAlign

align

0 (overrides Button)

bool

toggle_mode

true (overrides BaseButton)

主题属性

Color

font_color

Color( 0.88, 0.88, 0.88, 1 )

Color

font_color_disabled

Color( 0.9, 0.9, 0.9, 0.2 )

Color

font_color_focus

Color( 0.94, 0.94, 0.94, 1 )

Color

font_color_hover

Color( 0.94, 0.94, 0.94, 1 )

Color

font_color_hover_pressed

Color( 1, 1, 1, 1 )

Color

font_color_pressed

Color( 1, 1, 1, 1 )

int

check_vadjust

0

int

hseparation

4

Font

font

Texture

checked

Texture

checked_disabled

Texture

radio_checked

Texture

radio_checked_disabled

Texture

radio_unchecked

Texture

radio_unchecked_disabled

Texture

unchecked

Texture

unchecked_disabled

StyleBox

disabled

StyleBox

focus

StyleBox

hover

StyleBox

hover_pressed

StyleBox

normal

StyleBox

pressed

Theme Property Descriptions

Default

Color( 0.88, 0.88, 0.88, 1 )

CheckBox文本的字体颜色。


  • Color font_color_disabled

Default

Color( 0.9, 0.9, 0.9, 0.2 )

CheckBox文本被禁用时的字体颜色。


Default

Color( 0.94, 0.94, 0.94, 1 )

CheckBox 文本获得焦点时的字体颜色。只取代复选框的正常文本颜色。禁用、悬停和按下状态优先于这个颜色。


Default

Color( 0.94, 0.94, 0.94, 1 )

CheckBox文本在悬停时的字体颜色。


  • Color font_color_hover_pressed

Default

Color( 1, 1, 1, 1 )

CheckBox文本被悬停和按下时的字体颜色。


  • Color font_color_pressed

Default

Color( 1, 1, 1, 1 )

文本被按下时的字体颜色。


  • int check_vadjust

Default

0

呈现复选图标时使用的垂直偏移量(以像素为单位)。


  • int hseparation

Default

4

复选图标和文本之间的分隔(以像素为单位)。


用于CheckBox文本的Font


选中CheckBox时显示的复选图标。


CheckBox被选中和禁用时要显示的勾选图标。


如果将CheckBox配置为单选按钮,则选中CheckBox时显示的图标。



如果将CheckBox配置为单选按钮,则取消选中CheckBox时显示的图标。



未选中CheckBox时显示的复选图标。


CheckBox未被选中并被禁用时要显示的勾选图标。


CheckBox被禁用时,作为背景显示的StyleBox


CheckBox被聚焦时,作为背景显示的StyleBox


CheckBox被悬停时作为背景显示的StyleBox


CheckBox被悬停和按下时,作为背景显示的StyleBox


StyleBox显示为背景。


按下CheckBox时,StyleBox显示为背景。