2014-08-27, 07:54
Id like to have active search suggestions(Like the ones you have from many different websites) in the addon Im making but I cant figure out how to get the text while its being entered.
This is what I ended up trying:
But that just ended up spiting out the following in xbmc.log
This is what I ended up trying:
Code:
import xbmc
import sys
import xbmcgui
import xbmcplugin
import threading
class getTextThread(threading.Thread):
def __init__(self, keyboard):
threading.Thread.__init__(self)
self.running = 1
self.keyboard = keyboard
def run (self):
while self.running == 1:
Text = self.keyboard.getText()
print "Text = " + Text
xbmc.sleep(100)
def closeThread(self):
self.running = 0
addon_id = int(sys.argv[1])
paramstring = sys.argv[2]
if paramstring == '?test=true':
keyboard = xbmc.Keyboard()
a = getTextThread(keyboard)
a.start()
keyboard.doModal()
a.closeThread()
if keyboard.isConfirmed():
print "Final Keyboard Output = " + keyboard.getText()
else:
xbmcplugin.addDirectoryItem(addon_id, sys.argv[0] + '?test=true', xbmcgui.ListItem('Text Thread Test'), isFolder=False)
xbmcplugin.endOfDirectory(addon_id)
But that just ended up spiting out the following in xbmc.log
Code:
01:36:24 T:140015205263104 NOTICE: Text =
01:36:24 T:140015205263104 NOTICE: Text =
01:36:24 T:140015205263104 NOTICE: Text =
01:36:25 T:140015205263104 NOTICE: Text =
01:36:25 T:140014910428928 NOTICE: Final Keyboard Output = asdsdadsadcdacddacacsacacsacssscsccacsccasacas