Kodi Documentation 18.0
Kodi is an open source media player and entertainment hub.
Subclass - ControlRadioButton

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

Modules

 Font alignment flags
 Flags for alignment.
 

Classes

class  XBMCAddon::xbmcgui::ControlRadioButton
 

Functions

 XBMCAddon::xbmcgui::ControlRadioButton::setSelected (...)
 
 XBMCAddon::xbmcgui::ControlRadioButton::isSelected ()
 
 XBMCAddon::xbmcgui::ControlRadioButton::setLabel (...)
 
 XBMCAddon::xbmcgui::ControlRadioButton::setRadioDimension (...)
 

Detailed Description

For control a radio button (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. When the user clicks on the radio button, the state will change, toggling the extra textures (textureradioon and textureradiooff). 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 radio ON texture (deprecated, use focusOnTexture and noFocusOnTexture).
noFocusTexture[opt] string - filename for radio OFF texture (deprecated, use focusOffTexture and noFocusOffTexture).
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:
    Defination 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
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.
v16 Python API changes:
Deprecated focusTexture and noFocusTexture. Use focusOnTexture and noFocusOnTexture.

Example:

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

Function Documentation

◆ isSelected()

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> isSelected() </big></font></span></code></h4> \endhtmlonly

Returns the radio buttons's selected status.

Returns
True if selected on

Example:

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

◆ setLabel()

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

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> setLabel(label[, font, textColor, disabledColor, shadowColor, focusedColor]) </big></font></span></code></h4> \endhtmlonly

Set's 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 (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> setRadioDimension(x, y, width, height) </big></font></span></code></h4> \endhtmlonly

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 (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> setSelected(selected) </big></font></span></code></h4> \endhtmlonly

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)
...