Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
Subclass - ControlRadioButton

A radio button control (as used for on/off settings). More...

Topics

 Font alignment flags
 Flags for alignment.
 

Classes

class  XBMCAddon::xbmcgui::ControlRadioButton
 

Functions

 XBMCAddon::xbmcgui::ControlRadioButton::setSelected (...)
 

Function: setSelected(selected)


Sets the radio buttons's selected status.
 
 XBMCAddon::xbmcgui::ControlRadioButton::isSelected ()
 

Function: isSelected()


Returns the radio buttons's selected status.
 
 XBMCAddon::xbmcgui::ControlRadioButton::setLabel (...)
 

Function: setLabel(label[, font, textColor, disabledColor, shadowColor, focusedColor])


Sets the radio buttons text attributes.
 
 XBMCAddon::xbmcgui::ControlRadioButton::setRadioDimension (...)
 

Function: setRadioDimension(x, y, width, height)


Sets the radio buttons's radio texture's position and size.
 

Detailed Description

A radio button control (as used for on/off settings).

Class: ControlRadioButton(x, y, width, height, label[, focusOnTexture, noFocusOnTexture, focusOffTexture, noFocusOffTexture, focusTexture, noFocusTexture, textOffsetX, textOffsetY, alignment, font, textColor, disabledColor])

The radio button control is used for creating push button on/off settings in Kodi. You can choose the position, size, and look of the button, as well as the focused and unfocused radio textures. Used for settings controls.

Note
This class include also all calls from Control
Parameters
xinteger - x coordinate of control.
yinteger - y coordinate of control.
widthinteger - width of control.
heightinteger - height of control.
labelstring or unicode - text string.
focusOnTexture[opt] string - filename for radio ON focused texture.
noFocusOnTexture[opt] string - filename for radio ON not focused texture.
focusOfTexture[opt] string - filename for radio OFF focused texture.
noFocusOffTexture[opt] string - filename for radio OFF not focused texture.
focusTexture[opt] string - filename for focused button texture.
noFocusTexture[opt] string - filename for not focused button texture.
textOffsetX[opt] integer - horizontal text offset
textOffsetY[opt] integer - vertical text offset
alignment[opt] integer - alignment of label
  • Flags for alignment used as bits to have several together:
    Definition name Bitflag Description
    XBFONT_LEFT 0x00000000 Align X left
    XBFONT_RIGHT 0x00000001 Align X right
    XBFONT_CENTER_X 0x00000002 Align X center
    XBFONT_CENTER_Y 0x00000004 Align Y center
    XBFONT_TRUNCATED 0x00000008 Truncated text
    XBFONT_JUSTIFIED 0x00000010 Justify text
    XBFONT_TRUNCATED_LEFT 0x00000020 Truncated text from left
font[opt] string - font used for label text. (e.g. 'font13')
textColor[opt] hexstring - color of label when control is enabled. radiobutton's label. (e.g. '0xFFFFFFFF')
disabledColor[opt] hexstring - color of label when control is disabled. (e.g. '0xFFFF3300')
Note
You can use the above as keywords for arguments and skip certain optional arguments.
Once you use a keyword, all following arguments require the keyword.
After you create the control, you need to add it to the window with addControl().

v13 Python API changes
New function added.

Example:

...
self.radiobutton = xbmcgui.ControlRadioButton(100, 250, 200, 50, 'Enable', font='font14')
...

Function Documentation

◆ isSelected()

bool XBMCAddon::xbmcgui::ControlRadioButton::isSelected ( )

Function: isSelected()


Returns the radio buttons's selected status.

Returns
True if selected on

Example:

...
is = self.radiobutton.isSelected()
...

◆ setLabel()

void XBMCAddon::xbmcgui::ControlRadioButton::setLabel ( ...)

Function: setLabel(label[, font, textColor, disabledColor, shadowColor, focusedColor])


Sets the radio buttons text attributes.

Parameters
labelstring or unicode - text string.
font[opt] string - font used for label text. (e.g. 'font13')
textColor[opt] hexstring - color of enabled radio button's label. (e.g. '0xFFFFFFFF')
disabledColor[opt] hexstring - color of disabled radio button's label. (e.g. '0xFFFF3300')
shadowColor[opt] hexstring - color of radio button's label's shadow. (e.g. '0xFF000000')
focusedColor[opt] hexstring - color of focused radio button's label. (e.g. '0xFFFFFF00')
Note
You can use the above as keywords for arguments and skip certain optional arguments.
Once you use a keyword, all following arguments require the keyword.

Example:

...
# setLabel(label[, font, textColor, disabledColor, shadowColor, focusedColor])
self.radiobutton.setLabel('Status', 'font14', '0xFFFFFFFF', '0xFFFF3300', '0xFF000000')
...

◆ setRadioDimension()

void XBMCAddon::xbmcgui::ControlRadioButton::setRadioDimension ( ...)

Function: setRadioDimension(x, y, width, height)


Sets the radio buttons's radio texture's position and size.

Parameters
xinteger - x coordinate of radio texture.
yinteger - y coordinate of radio texture.
widthinteger - width of radio texture.
heightinteger - height of radio texture.
Note
You can use the above as keywords for arguments and skip certain optional arguments.
Once you use a keyword, all following arguments require the keyword.

Example:

...
self.radiobutton.setRadioDimension(x=100, y=5, width=20, height=20)
...

◆ setSelected()

void XBMCAddon::xbmcgui::ControlRadioButton::setSelected ( ...)

Function: setSelected(selected)


Sets the radio buttons's selected status.

Parameters
selectedbool - True=selected (on) / False=not selected (off)
Note
You can use the above as keywords for arguments and skip certain optional arguments.
Once you use a keyword, all following arguments require the keyword.

Example:

...
self.radiobutton.setSelected(True)
...