blob: 63491d23e2e0b1268a7f8ab5e714a4c4bab7e378 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
"""Dialogue with a slider.
Part of the tagit module.
A copy of the license is provided with the project.
Author: Matthias Baumgartner, 2022
"""
# kivy imports
from kivy.lang import Builder
import kivy.properties as kp
# inner-module imports
from .dialogue import Dialogue
# exports
__all__ = ('NumericInput', )
## code ##
# load kv
Builder.load_string('''
<NumericInput>:
value: int(slider.value)
init_value: 0
DialogueContentNoTitle:
BoxLayout:
orientation: 'horizontal'
size_hint_y: None
height: 50
Label:
text: str(root.lo)
size_hint_x: None
width: self.texture_size[0]
Slider:
id: slider
orientation: 'horizontal'
min: root.lo
max: root.hi
step: 1
value: root.init_value
Label:
text: str(root.hi)
size_hint_x: None
width: self.texture_size[0]
Label:
text: str(root.value)
size_hint: 1, None
height: self.texture_size[1]
halign: 'center'
DialogueButtons_Two:
''')
# classes
class NumericInput(Dialogue):
"""Dialogue with a slider."""
lo = kp.NumericProperty(0)
hi = kp.NumericProperty(100)
value = kp.NumericProperty(0)
init_value = kp.NumericProperty(0)
## EOF ##
|