本文介紹了在更改時顯示 kivy 滑塊值的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我想知道是否可以將 kivy 微調器值顯示為移動標簽,以便用戶確切知道滑塊的當前值是什么.
I was wondering whether it was possible to displays kivy spinner values as a moving label, so that the user knows exactly what the current value of the slider is.
謝謝
推薦答案
你只需綁定一個監聽器到值改變事件
you just bind a listener to the value change event
some_label = Label(...)
my_slider = Slider(...)
def OnSliderValueChange(instance,value):
some_label.text = str(value)
my_slider.bind(value=OnSliderValueChange)
正如 .kv 文件中指出的那樣,您可以執行類似的操作
as inclement points out in the .kv file you could do something like
<PongGame>:
...
canvas:
Rectangle:
...
Label:
...
text: str(slider_id.value)
Slider:
...
id: slider_id
這篇關于在更改時顯示 kivy 滑塊值的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!