问题描述
是我还是没有使用xbmcgui.ControlSlider
的示例?我有以下代码:
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.
推荐答案
xbmcgui.ControlSlider类((x,y,宽度,高度,textureback = None,texture = None,texturefocus = None,方向) =垂直)
class xbmcgui.ControlSlider(x, y, width, height, textureback=None, texture=None, texturefocus=None, orientation=VERTICAL)
基础:xbmcgui.Control
Bases: xbmcgui.Control
ControlSlider类.
创建一个滑块.
参数:
- x –整数– x控制坐标.
- y –整数– y的控制坐标.
- width –整数–控件的宽度.
- height –整数–控制高度.
- textureback –字符串–图像文件名.
- 纹理–字符串–图像文件名.
- texturefocus –字符串–图像文件名.
- 方向–整数–滑块的方向
注意:默认情况下,ControlSlider具有垂直方向.
Notes:By default a ControlSlider has vertical orientation.
创建控件后,需要使用addControl()将其添加到窗口中.
示例:
self.slider = xbmcgui.ControlSlider(100, 250, 350, 40)
方法:
getPercent()
返回滑块百分比的浮点数.
Returns a float of the percent of the slider.
示例:
self.slider = xbmcgui.ControlSlider(100, 250, 350, 40)
percent = self.slider.getPercent()
setPercent(percent)
设置滑块的百分比.
参数:百分比–浮动–滑块%值
Parameters: percent – float – slider % value
示例:
self.slider = xbmcgui.ControlSlider(100, 250, 350, 40)
percent = self.slider.setPercent(20)
这篇关于有关如何将xbmcgui.ControlSlider与操作一起使用的完整示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!