test-kivy-app/kivy_venv/share/kivy-examples/widgets/textalign.kv

50 lines
1.3 KiB
Plaintext
Raw Normal View History

2024-09-15 12:12:16 +00:00
#:kivy 1.0
<BoundedLabel>:
canvas.before:
Color:
rgb: 1, 0, 0
Rectangle:
pos: self.pos
size: self.size
<Selector>:
grid: _grid
Label:
pos_hint: {'top': 1}
size_hint_y: None
height: 50
font_size: 16
text: 'Demonstration of text valign and halign'
GridLayout:
id: _grid
rows: 3
cols: 3
spacing: 10
size_hint: (None, None)
pos_hint: {'center_x': .5, 'center_y': .5}
BoxLayout:
size_hint_y: None
height: 50
ToggleButton:
halign: 'center'
group: 'case'
text: 'label.text_size =\n(None, None)'
on_release: root.app.select(0)
state: 'down'
ToggleButton:
halign: 'center'
group: 'case'
text: 'label.text_size =\n(label.width, None)'
on_release: root.app.select(1)
ToggleButton:
halign: 'center'
group: 'case'
text: 'label.text_size =\n(None, label.height)'
on_release: root.app.select(2)
ToggleButton:
halign: 'center'
group: 'case'
text: 'label.text_size =\n(label.width, label.height)'
on_release: root.app.select(3)