Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
Subclass - ControlButton

Detailed Description

A standard push button control.

Class: ControlButton(x, y, width, height, label[, focusTexture, noFocusTexture, textOffsetX, textOffsetY, /// alignment, font, textColor, disabledColor, angle, shadowColor, focusedColor])

The button control is used for creating push buttons in Kodi. You can choose the position, size, and look of the button, as well as choosing what action(s) should be performed when pushed.

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.
focusTexture[opt] string - filename for focus texture.
noFocusTexture[opt] string - filename for no focus texture.
textOffsetX[opt] integer - x offset of label.
textOffsetY[opt] integer - y offset of label.
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 enabled button's label. (e.g. '0xFFFFFFFF')
disabledColor[opt] hexstring - color of disabled button's label. (e.g. '0xFFFF3300')
angle[opt] integer - angle of control. (+ rotates CCW, - rotates CW)
shadowColor[opt] hexstring - color of button's label's shadow. (e.g. '0xFF000000')
focusedColor[opt] hexstring - color of focused button's label. (e.g. '0xFF00FFFF')
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().

Example:

...
# ControlButton(x, y, width, height, label[, focusTexture, noFocusTexture, textOffsetX, textOffsetY,
# alignment, font, textColor, disabledColor, angle, shadowColor, focusedColor])
self.button = xbmcgui.ControlButton(100, 250, 200, 50, 'Status', font='font14')
...

Function Documentation

◆ setLabel()

setLabel ( ...)

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


Sets this buttons text attributes.

Parameters
label[opt] string or unicode - text string.
font[opt] string - font used for label text. (e.g. 'font13')
textColor[opt] hexstring - color of enabled button's label. (e.g. '0xFFFFFFFF')
disabledColor[opt] hexstring - color of disabled button's label. (e.g. '0xFFFF3300')
shadowColor[opt] hexstring - color of button's label's shadow. (e.g. '0xFF000000')
focusedColor[opt] hexstring - color of focused button's label. (e.g. '0xFFFFFF00')
label2[opt] string or unicode - text string.
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.button.setLabel('Status', 'font14', '0xFFFFFFFF', '0xFFFF3300', '0xFF000000')
...

◆ setDisabledColor()

setDisabledColor ( ...)

Function: setDisabledColor(disabledColor)


Sets this buttons disabled color.

Parameters
disabledColorhexstring - color of disabled button's label. (e.g. '0xFFFF3300')

Example:

...
# setDisabledColor(disabledColor)
self.button.setDisabledColor('0xFFFF3300')
...

◆ getLabel()

getLabel ( )

Function: getLabel()


Returns the buttons label as a unicode string.

Returns
Unicode string

Example:

...
# getLabel()
label = self.button.getLabel()
...

◆ getLabel2()

getLabel2 ( )

Function: getLabel2()


Returns the buttons label2 as a string.

Returns
string of label 2

Example:

...
# getLabel2()
label = self.button.getLabel2()
...