Kodi Development  20.0
for Binary and Script based Add-Ons

Detailed Description

Kodi's keyboard class.

Class: xbmc.Keyboard([default, heading, hidden])

Creates a new Keyboard object with default text heading and hidden input flag if supplied.

Parameters
default: [opt] string - default text entry.
heading: [opt] string - keyboard heading.
hidden: [opt] boolean - True for hidden text entry.

Example:

..
kb = xbmc.Keyboard('default', 'heading', True)
kb.setDefault('password') # optional
kb.setHeading('Enter password') # optional
kb.setHiddenInput(True) # optional
kb.doModal()
if (kb.isConfirmed()):
text = kb.getText()
..

Variables

bool bConfirmed = false
 
bool bHidden
 
String strDefault
 
String strHeading
 
String strText
 

Function Documentation

◆ doModal()

doModal (   ...)

Function: doModal([autoclose])


Show keyboard and wait for user action.

Parameters
autoclose[opt] integer - milliseconds to autoclose dialog. (default=do not autoclose)

Example:

..
kb.doModal(30000)
..

◆ setDefault()

setDefault (   ...)

Function: setDefault(line)


Set the default text entry.

Parameters
linestring - default text entry.

Example:

..
kb.setDefault('password')
..

◆ setHiddenInput()

setHiddenInput (   ...)

Function: setHiddenInput(hidden)


Allows hidden text entry.

Parameters
hiddenboolean - True for hidden text entry.

Example:

..
kb.setHiddenInput(True)
..

◆ setHeading()

setHeading (   ...)

Function: setHeading(heading)


Set the keyboard heading.

Parameters
headingstring - keyboard heading.

Example:

..
kb.setHeading('Enter password')
..

◆ getText()

getText ( )

Function: getText()


Returns the user input as a string.

Note
This will always return the text entry even if you cancel the keyboard. Use the isConfirmed() method to check if user cancelled the keyboard.
Returns
get the in keyboard entered text

Example:

..
text = kb.getText()
..

◆ isConfirmed()

isConfirmed ( )

Function: isConfirmed()


Returns False if the user cancelled the input.

Returns
true if confirmed, if cancelled false

Example:

..
if (kb.isConfirmed()):
..