Kodi Community Forum

Full Version: ControlSlider setPercent not working ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Yall

either if found a bug or im doing something wrong (probably the latter). why can't i change the slider from 50% ?

ive simplified things right down to only the slider for now (and a label)
Code:
import xbmc, xbmcgui, sys

NUMBER = sys.argv[1]

window = xbmcgui.WindowDialog()

TEXT = xbmcgui.ControlLabel(x=65, y=15, width=100, height=50, label=NUMBER, font='font35_title', textColor='0xFFFFFFFF')

SLIDE = xbmcgui.ControlSlider(x=100, y=15, width=100, height=50,
  texture=xbmc.translatePath("special://home/addons/script.myscript/img/slider.front.png"),
  textureback=xbmc.translatePath("special://home/addons/script.myscript/img/slider.back.png") )

SLIDE.setPercent(int(NUMBER))

window.addControl(TEXT)
window.addControl(SLIDE)

window.show()
xbmc.sleep(1000)
window.close()
del window

i'm testing it from the command line with
Code:
for x in $(seq 0 10 100) ; do kodi-send --action="RunScript(script.myScript, $x)" 1>/dev/null ; sleep 1 ; done

what am i missing ?
perhaps you first need to add it to the window before you can set the percentage?
thanks that is what i was missing.