-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathnotice_box.py
More file actions
38 lines (33 loc) · 894 Bytes
/
Copy pathnotice_box.py
File metadata and controls
38 lines (33 loc) · 894 Bytes
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
from kivy.properties import StringProperty, ObjectProperty
from kivy.lang import Builder
from kivy.uix.popup import Popup
from kivy.app import App
from kivy.core.text import Label as CoreLabel
Builder.load_string('''
<NoticeBox>:
size_hint: .5, None
height: sp(48+140)
auto_dismiss: False
title: root.text
title_align: 'center'
title_size: '20sp'
BoxLayout:
orientation: 'vertical'
Label:
text: root.additional_text
Button:
size_hint_y: None
height: sp(48)
text: root.ok_text
on_press: root.ok()
''')
class NoticeBox(Popup):
text = StringProperty('')
cb = ObjectProperty()
message = StringProperty('')
ok_text = StringProperty('OK')
additional_text = StringProperty('')
def ok(self):
if self.cb:
self.cb(True)
self.dismiss()