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

Detailed Description

GUI window class for Add-Ons.

This class allows over their functions to create and edit windows that can be accessed from an Add-On.

Likewise, all functions from here as well in the other window classes WindowDialog, WindowXML and WindowXMLDialog with inserted and available.


Constructor for window

Class: xbmcgui.Window([existingWindowId]):

Creates a new from Add-On usable window class. This is to create window for related controls by system calls.

Parameters
existingWindowId[opt] Specify an id to use an existing window.
Exceptions
ValueErrorif supplied window Id does not exist.
Exceptionif more then 200 windows are created.

Deleting this window will activate the old window that was active and resets (not delete) all controls that are associated with this window.


Example:

..
win = xbmcgui.Window()
width = win.getWidth()
..

Topics

 Subclass - WindowDialog
 GUI window dialog class for Add-Ons.
 
 Callback functions from Kodi to add-on
 GUI window callback functions.
 
 Subclass - WindowXML
 GUI xml window class.
 

Function Documentation

◆ show()

show ( )

Function: show()


Show this window.

Shows this window by activating it, calling close() after it wil activate the current window again.

Note
If your script ends this window will be closed to. To show it forever, make a loop at the end of your script or use doModal() instead.

◆ setFocus()

setFocus ( ...)

Function: setFocus(Control)


Give the supplied control focus.

Parameters
ControlControl class to focus
Exceptions
TypeErrorIf supplied argument is not a Control type
SystemErrorOn Internal error
RuntimeErrorIf control is not added to a window

◆ setFocusId()

setFocusId ( ...)

Function: setFocusId(ControlId)


Gives the control with the supplied focus.

Parameters
ControlId[integer] On skin defined id of control
Exceptions
SystemErrorOn Internal error
RuntimeErrorIf control is not added to a window

◆ getFocus()

getFocus ( )

Function: getFocus(Control)


Returns the control which is focused.

Returns
Focused control class
Exceptions
SystemErrorOn Internal error
RuntimeErrorIf no control has focus

◆ getFocusId()

getFocusId ( )

Function: getFocusId(int)


Returns the id of the control which is focused.

Returns
Focused control id
Exceptions
SystemErrorOn Internal error
RuntimeErrorIf no control has focus

◆ removeControl()

removeControl ( ...)

Function: removeControl(Control)


Removes the control from this window.

Parameters
ControlControl class to remove
Exceptions
TypeErrorIf supplied argument is not a Control type
RuntimeErrorIf control is not added to this window

This will not delete the control. It is only removed from the window.

◆ removeControls()

removeControls ( ...)

Function: removeControls(List)


Removes a list of controls from this window.

Parameters
ListList with controls to remove
Exceptions
TypeErrorIf supplied argument is not a Control type
RuntimeErrorIf control is not added to this window

This will not delete the controls. They are only removed from the window.

◆ getHeight()

getHeight ( )

Function: getHeight()


Returns the height of this Window instance.

Returns
Window height in pixels

v18 Python API changes
Function changed

◆ getWidth()

getWidth ( )

Function: getWidth()


Returns the width of this Window instance.

Returns
Window width in pixels

v18 Python API changes
Function changed

◆ setProperty()

setProperty ( ...)

Function: setProperty(key, value)


Sets a window property, similar to an infolabel.

Parameters
keystring - property name.
valuestring or unicode - value of property.
Note
Key is NOT case sensitive. Setting value to an empty string is equivalent to clearProperty(key).
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:

..
win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
win.setProperty('Category', 'Newest')
..

◆ getProperty()

getProperty ( ...)

Function: getProperty(key)


Returns a window property as a string, similar to an infolabel.

Parameters
keystring - property name.
Note
Key is NOT case sensitive.
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:

..
win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
category = win.getProperty('Category')
..

◆ clearProperty()

clearProperty ( ...)

Function: clearProperty(key)


Clears the specific window property.

Parameters
keystring - property name.
Note
Key is NOT case sensitive. Equivalent to setProperty(key,'') 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:

..
win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
win.clearProperty('Category')
..

◆ clearProperties()

clearProperties ( )

Function: clearProperties()


Clears all window properties.


Example:

..
win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
win.clearProperties()
..

◆ close()

close ( )

Function: close()


Closes this window.

Closes this window by activating the old window.

Note
The window is not deleted with this method.

◆ doModal()

doModal ( )

Function: doModal()


Display this window until close() is called.

◆ addControl()

addControl ( ...)

Function: addControl(Control)


Add a Control to this window.

Parameters
ControlControl to add
Exceptions
TypeErrorIf supplied argument is not a Control type
ReferenceErrorIf control is already used in another window
RuntimeErrorShould not happen :-)

The next controls can be added to a window atm

Control-class Description
ControlLabel Label control to show text
ControlFadeLabel The fadelabel has multiple labels which it cycles through
ControlTextBox To show bigger text field
ControlButton Brings a button to do some actions
ControlEdit The edit control allows a user to input text in Kodi
ControlFadeLabel The fade label control is used for displaying multiple pieces of text in the same space in Kodi
ControlList Add a list for something like files
ControlGroup Is for a group which brings the others together
ControlImage Controls a image on skin
ControlRadioButton For a radio button which handle boolean values
ControlProgress Progress bar for a performed work or something else
ControlSlider The slider control is used for things where a sliding bar best represents the operation at hand
ControlSpin The spin control is used for when a list of options can be chosen
ControlTextBox The text box is used for showing a large multipage piece of text in Kodi

◆ addControls()

addControls ( ...)

Function: addControls(List)


Add a list of Controls to this window.

Parameters
ListList with controls to add
Exceptions
TypeErrorIf supplied argument is not of List type, or a control is not of Control type
ReferenceErrorIf control is already used in another window
RuntimeErrorShould not happen :-)

◆ getControl()

getControl ( ...)

Function: getControl(controlId)


Gets the control from this window.

Parameters
controlIdControl id to get
Exceptions
ExceptionIf Control doesn't exist
Remarks
controlId doesn't have to be a python control, it can be a control id from a Kodi window too (you can find id's in the xml files.
Note
Not python controls are not completely usable yet You can only use the Control functions