A complete example of how to use xbmcgui.ControlSl

2019-09-05 07:42发布

Is it me or there is no example of how to use xbmcgui.ControlSlider? I have this code:

    self.mediaPath=os.path.join(addon.getAddonInfo('path'),'resources','media') + '/'
    self.slider = xbmcgui.ControlSlider(19, 415, 1242, 130,self.mediaPath + 'tran.png',self.mediaPath + 'poser.png',self.mediaPath + 'poser.png')
    self.addControl(self.slider)

But I can't find how to detect slider actions.

标签: slider kodi
1条回答
我命由我不由天
2楼-- · 2019-09-05 08:32

class xbmcgui.ControlSlider(x, y, width, height, textureback=None, texture=None, texturefocus=None, orientation=VERTICAL)

Bases: xbmcgui.Control

ControlSlider class.

Creates a slider.

Parameters:

  • x – integer – x coordinate of control.
  • y – integer – y coordinate of control.
  • width – integer – width of control.
  • height – integer – height of control.
  • textureback – string – image filename.
  • texture – string – image filename.
  • texturefocus – string – image filename.
  • orientation – int – orientation of the slider

Notes: By default a ControlSlider has vertical orientation.

After you create the control, you need to add it to the window with addControl().

Example:

self.slider = xbmcgui.ControlSlider(100, 250, 350, 40)

Methods:

getPercent()

Returns a float of the percent of the slider.

Example:

self.slider = xbmcgui.ControlSlider(100, 250, 350, 40)
percent = self.slider.getPercent()

setPercent(percent)

Sets the percent of the slider.

Parameters: percent – float – slider % value

Example:

self.slider = xbmcgui.ControlSlider(100, 250, 350, 40)
percent = self.slider.setPercent(20)
查看更多
登录 后发表回答