forked from Priyanshu-server/kivyAndKivyMD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Theme and buttons.py
58 lines (42 loc) · 1.1 KB
/
Theme and buttons.py
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
from kivymd.app import MDApp
from kivy.uix.screenmanager import Screen,ScreenManager
from kivy.lang import Builder
#Builder String
helper_string = '''
ScreenManager:
Hello:
Bye:
<Hello>:
name: 'hello'
MDLabel:
text: 'Hello!! world'
halign: 'center'
theme_text_color: 'Custom'
text_color : 148/255,0,211/255,1
font_style : 'H1'
MDRectangleFlatIconButton:
icon: 'android'
text: 'Hello'
user_font_size: '100sp'
pos_hint: {'center_x':0.5,'center_y':0.4}
<Bye>
name: 'bye'
MDLabel:
text: 'Good Bye'
'''
class Hello(Screen):
pass
class Bye(Screen):
pass
sm = ScreenManager()
sm.add_widget(Hello(name = 'hello'))
sm.add_widget(Bye(name='bye'))
class DemoApp(MDApp):
def build(self):
self.theme_cls.primary_palette = 'Green'
self.theme_cls.primary_hue = 'A700'
screen = Screen()
help_str = Builder.load_string(helper_string)
screen.add_widget(help_str)
return screen
DemoApp().run()