python模拟鼠标拖动滑块_如何通过拖动滑块来控制Kivy滚动视图?
是的,你可以這樣做:
在ScrollView中有一個scroll_類型屬性,因此通過設(shè)置它,您可以實現(xiàn)您想要的功能。在
如果設(shè)置scroll_type=['bars'],則可能需要更改bar_width屬性,因為它的默認(rèn)值為2,而且它太小,無法用鼠標(biāo)抓取
以下是基于文檔中的示例:layout = GridLayout(cols=1, spacing=10, size_hint_y=None)
# Make sure the height is such that there is something to scroll.
layout.bind(minimum_height=layout.setter('height'))
for i in range(30):
btn = Button(text=str(i), size_hint_y=None, height=40)
layout.add_widget(btn)
root = ScrollView(size_hint=(None, None), size=(400, 400),
scroll_type=['bars'], bar_width='10dp') #you can use both ['bars','content']
root.add_widget(layout)
你可以瀏覽一下這些文件,看看你還可以根據(jù)自己的需要做些什么改變。在
總結(jié)
以上是生活随笔為你收集整理的python模拟鼠标拖动滑块_如何通过拖动滑块来控制Kivy滚动视图?的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python机器人编程教程入门_机器人编
- 下一篇: html 在手机上运行,怎么在手机上打开