kv 언어로 슬라이더와 TextInput의 값을 연결합니다
개요
kv 언어로 슬라이더와 TextInput의 값을 연결합니다.
컨디션
python
main.py
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
class RootWidget(BoxLayout):
pass
class MainApp(App):
def build(self):
return RootWidget()
if __name__ == '__main__':
MainApp().run()
kv
main.kv
<RootWidget>:
orientation: 'vertical'
BoxLayout: # dummy
BoxLayout:
size_hint_y: None
height: 50.0
Slider:
id: testSlider
size_hint_x: 0.75
min: 0.0
max: 100.0
value: 20.0
# on_touch_move: testTextContent.text = '{:.0f}'.format(self.value) # sliderはイベント不要
TextInput:
id: testTextContent
size_hint_x: 0.25
text: '{:.0f}'.format(testSlider.value) # sliderの値を取得
multiline: False
on_text_validate: testSlider.value = int(self.text) # sliderに値を設定
BoxLayout: # dummy
결실
Reference
이 문제에 관하여(kv 언어로 슬라이더와 TextInput의 값을 연결합니다), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/SKYS/items/b60734f77fc01746ddfd텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)