A complete example of how to use xbmcgui.ControlSlider with actions

邮差的信 提交于 2019-12-12 03:28:15

问题


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.


回答1:


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)


来源:https://stackoverflow.com/questions/35698269/a-complete-example-of-how-to-use-xbmcgui-controlslider-with-actions

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!