Kodi Documentation  20.0
Kodi is an open source media player and entertainment hub.

Code based skin access. More...

Collaboration diagram for Control:

Modules

 Subclass - ControlSpin
 Used for cycling up/down controls.
 
 Subclass - ControlLabel
 Used to show some lines of text.
 
 Subclass - ControlEdit
 
 Subclass - ControlList
 Used for a scrolling lists of items. Replaces the list control.
 
 Subclass - ControlFadeLabel
 Used to show multiple pieces of text in the same position, by fading from one to the other.
 
 Subclass - ControlTextBox
 Used to show a multi-page piece of text.
 
 Subclass - ControlImage
 Used to show an image.
 
 Subclass - ControlProgress
 Used to show the progress of a particular operation.
 
 Subclass - ControlButton
 A standard push button control.
 
 Subclass - ControlGroup
 Used to group controls together..
 
 Subclass - ControlRadioButton
 A radio button control (as used for on/off settings).
 
 Subclass - ControlSlider
 Used for a volume slider.
 

Classes

class  XBMCAddon::xbmcgui::Control
 

Functions

 XBMCAddon::xbmcgui::Control::getId () inline bool operator
 

Function: getId()


Returns the control's current id as an integer. More...
 
 XBMCAddon::xbmcgui::Control::getX ()
 

Function: getX()


Returns the control's current X position. More...
 
 XBMCAddon::xbmcgui::Control::getY ()
 

Function: getY()


Returns the control's current Y position. More...
 
 XBMCAddon::xbmcgui::Control::getHeight ()
 

Function: getHeight()


Returns the control's current height as an integer. More...
 
 XBMCAddon::xbmcgui::Control::getWidth ()
 

Function: getWidth()


Returns the control's current width as an integer. More...
 
 XBMCAddon::xbmcgui::Control::setEnabled (...)
 

Function: setEnabled(enabled)


Sets the control's enabled/disabled state. More...
 
 XBMCAddon::xbmcgui::Control::setVisible (...)
 

Function: setVisible(visible)


Sets the control's visible/hidden state. More...
 
 XBMCAddon::xbmcgui::Control::isVisible (...)
 

Function: isVisible()


Get the control's visible/hidden state with respect to the container/window More...
 
 XBMCAddon::xbmcgui::Control::setVisibleCondition (...)
 

Function: setVisibleCondition(visible[,allowHiddenFocus])


Sets the control's visible condition. More...
 
 XBMCAddon::xbmcgui::Control::setEnableCondition (...)
 

Function: setEnableCondition(enable)


Sets the control's enabled condition. More...
 
 XBMCAddon::xbmcgui::Control::setAnimations (...)
 

Function: setAnimations([(event, attr,)*])


Sets the control's animations. More...
 
 XBMCAddon::xbmcgui::Control::setPosition (...)
 

Function: setPosition(x, y)


Sets the controls position. More...
 
 XBMCAddon::xbmcgui::Control::setWidth (...)
 

Function: setWidth(width)


Sets the controls width. More...
 
 XBMCAddon::xbmcgui::Control::setHeight (...)
 

Function: setHeight(height)


Sets the controls height. More...
 
 XBMCAddon::xbmcgui::Control::setNavigation (...)
 

Function: setNavigation(up, down, left, right)


Sets the controls navigation. More...
 
 XBMCAddon::xbmcgui::Control::controlUp (...)
 

Function: controlUp(control)


Sets the controls up navigation. More...
 
 XBMCAddon::xbmcgui::Control::controlDown (...)
 

Function: controlDown(control)


Sets the controls down navigation. More...
 
 XBMCAddon::xbmcgui::Control::controlLeft (...)
 

Function: controlLeft(control)


Sets the controls left navigation. More...
 
 XBMCAddon::xbmcgui::Control::controlRight (...)
 

Function: controlRight(control)


Sets the controls right navigation. More...
 

Detailed Description

Code based skin access.

Offers classes and functions that manipulate the add-on gui controls.


Class: Control()

Code based skin access.

Kodi is noted as having a very flexible and robust framework for its GUI, making theme-skinning and personal customization very accessible. Users can create their own skin (or modify an existing skin) and share it with others.

Kodi includes a new GUI library written from scratch. This library allows you to skin/change everything you see in Kodi, from the images, the sizes and positions of all controls, colours, fonts, and text, through to altering navigation and even adding new functionality. The skin system is quite complex, and this portion of the manual is dedicated to providing in depth information on how it all works, along with tips to make the experience a little more pleasant.


Function Documentation

◆ controlDown()

void XBMCAddon::xbmcgui::Control::controlDown (   ...)

Function: controlDown(control)


Sets the controls down navigation.

Parameters
controlcontrol object - control to navigate to on down.
Exceptions
TypeErrorif one of the supplied arguments is not a control type.
ReferenceErrorif one of the controls is not added to a window.
Note
You can also use setNavigation(). Set to self to disable navigation.

Example:

...
self.button.controlDown(self.button1)
...

◆ controlLeft()

void XBMCAddon::xbmcgui::Control::controlLeft (   ...)

Function: controlLeft(control)


Sets the controls left navigation.

Parameters
controlcontrol object - control to navigate to on left.
Exceptions
TypeErrorif one of the supplied arguments is not a control type.
ReferenceErrorif one of the controls is not added to a window.
Note
You can also use setNavigation(). Set to self to disable navigation.

Example:

...
self.button.controlLeft(self.button1)
...

◆ controlRight()

void XBMCAddon::xbmcgui::Control::controlRight (   ...)

Function: controlRight(control)


Sets the controls right navigation.

Parameters
controlcontrol object - control to navigate to on right.
Exceptions
TypeErrorif one of the supplied arguments is not a control type.
ReferenceErrorif one of the controls is not added to a window.
Note
You can also use setNavigation(). Set to self to disable navigation.

Example:

...
self.button.controlRight(self.button1)
...

◆ controlUp()

void XBMCAddon::xbmcgui::Control::controlUp (   ...)

Function: controlUp(control)


Sets the controls up navigation.

Parameters
controlcontrol object - control to navigate to on up.
Exceptions
TypeErrorif one of the supplied arguments is not a control type.
ReferenceErrorif one of the controls is not added to a window.
Note
You can also use setNavigation(). Set to self to disable navigation.

Example:

...
self.button.controlUp(self.button1)
...

◆ getHeight()

XBMCAddon::xbmcgui::Control::getHeight ( )

Function: getHeight()


Returns the control's current height as an integer.

Returns
int - Current height

Example:

...
height = self.button.getHeight()
...

◆ getId()

XBMCAddon::xbmcgui::Control::getId ( )

Function: getId()


Returns the control's current id as an integer.

Returns
int - Current id

Example:

...
id = self.button.getId()
...

◆ getWidth()

XBMCAddon::xbmcgui::Control::getWidth ( )

Function: getWidth()


Returns the control's current width as an integer.

Returns
int - Current width

Example:

...
width = self.button.getWidth()
...

◆ getX()

XBMCAddon::xbmcgui::Control::getX ( )

Function: getX()


Returns the control's current X position.

Returns
int - Current X position

Example:

...
posX = self.button.getX()
...

◆ getY()

XBMCAddon::xbmcgui::Control::getY ( )

Function: getY()


Returns the control's current Y position.

Returns
int - Current Y position

Example:

...
posY = self.button.getY()
...

◆ isVisible()

bool XBMCAddon::xbmcgui::Control::isVisible (   ...)

Function: isVisible()


Get the control's visible/hidden state with respect to the container/window

Note
If a given control is set visible (c.f. setVisible() but was not yet added to a window, this method will return False (the control is not visible yet since it was not added to the window).
v18 Python API changes:
New function added.

Example:

...
if self.button.isVisible():
...

◆ setAnimations()

void XBMCAddon::xbmcgui::Control::setAnimations (   ...)

Function: setAnimations([(event, attr,)*])


Sets the control's animations.

[(event,attr,)*]: list - A list of tuples consisting of event and attributes pairs.

Animating your skin

Parameters
eventstring - The event to animate.
attrstring - The whole attribute string separated by spaces.

Example:

...
# setAnimations([(event, attr,)*])
self.button.setAnimations([('focus', 'effect=zoom end=90,247,220,56 time=0',)])
...

◆ setEnableCondition()

void XBMCAddon::xbmcgui::Control::setEnableCondition (   ...)

Function: setEnableCondition(enable)


Sets the control's enabled condition.

Allows Kodi to control the enabled status of the control.

List of Conditions

Parameters
enablestring - Enable condition.

Example:

...
# setEnableCondition(enable)
self.button.setEnableCondition('System.InternetState')
...

◆ setEnabled()

void XBMCAddon::xbmcgui::Control::setEnabled (   ...)

Function: setEnabled(enabled)


Sets the control's enabled/disabled state.

Parameters
enabledbool - True=enabled / False=disabled.

Example:

...
self.button.setEnabled(False)
...

◆ setHeight()

void XBMCAddon::xbmcgui::Control::setHeight (   ...)

Function: setHeight(height)


Sets the controls height.

Parameters
heightinteger - height of control.

Example:

...
self.image.setHeight(100)
...

◆ setNavigation()

void XBMCAddon::xbmcgui::Control::setNavigation (   ...)

Function: setNavigation(up, down, left, right)


Sets the controls navigation.

Parameters
upcontrol object - control to navigate to on up.
downcontrol object - control to navigate to on down.
leftcontrol object - control to navigate to on left.
rightcontrol object - control to navigate to on right.
Exceptions
TypeErrorif one of the supplied arguments is not a control type.
ReferenceErrorif one of the controls is not added to a window.
Note
Same as controlUp(), controlDown(), controlLeft(), controlRight(). Set to self to disable navigation for that direction.

Example:

...
self.button.setNavigation(self.button1, self.button2, self.button3, self.button4)
...

◆ setPosition()

void XBMCAddon::xbmcgui::Control::setPosition (   ...)

Function: setPosition(x, y)


Sets the controls position.

Parameters
xinteger - x coordinate of control.
yinteger - y coordinate of control.
Note
You may use negative integers. (e.g sliding a control into view)

Example:

...
self.button.setPosition(100, 250)
...

◆ setVisible()

void XBMCAddon::xbmcgui::Control::setVisible (   ...)

Function: setVisible(visible)


Sets the control's visible/hidden state.

Parameters
visiblebool - True=visible / False=hidden.

v19 Python API changes:
You can now define the visible state of a control before it being added to a window. This value will be taken into account when the control is later added.

Example:

...
self.button.setVisible(False)
...

◆ setVisibleCondition()

void XBMCAddon::xbmcgui::Control::setVisibleCondition (   ...)

Function: setVisibleCondition(visible[,allowHiddenFocus])


Sets the control's visible condition.

Allows Kodi to control the visible status of the control.

List of Conditions

Parameters
visiblestring - Visible condition
allowHiddenFocus[opt] bool - True=gains focus even if hidden

Example:

...
# setVisibleCondition(visible[,allowHiddenFocus])
self.button.setVisibleCondition('[Control.IsVisible(41) + !Control.IsVisible(12)]', True)
...

◆ setWidth()

void XBMCAddon::xbmcgui::Control::setWidth (   ...)

Function: setWidth(width)


Sets the controls width.

Parameters
widthinteger - width of control.

Example:

...
self.image.setWidth(100)
...