-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
76 lines (62 loc) · 2.2 KB
/
main.py
File metadata and controls
76 lines (62 loc) · 2.2 KB
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
73
74
75
76
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.lang import Builder
class TaskScreen(Screen):
pass
class TaskPopup(Screen):
pass
task_popup='''
<TaskPopup>:
FloatLayout:
TextInput:
text: 'Write your task here'
size_hint: (1,0.25)
pos_hint: {'x':0,'y':0.75}
Button:
text: 'Send task'
size_hint: (1,0.25)
pos_hint: {'x':0,'y':0.5}
Button:
text: 'See all Tasks'
size_hint: (1,0.25)
pos_hint: {'x':0,'y':0.25}
Button:
text: 'Go back'
on_release: root.manager.current = 'main_screen'
size_hint: (1,0.25)
pos_hint: {'x':0,'y':0}
'''
class MainScreen (Screen):
def __init__ (self,**kwargs):
super(MainScreen,self).__init__(**kwargs)
main_screen= BoxLayout(orientation='vertical')
options= GridLayout(rows=2,cols=2,size_hint=(1,0.6),pos_hint={'x':0,'y':0.4})
about= FloatLayout(size_hint=(1,0.4),pos_hint={'x':0,'y':0})
ui= Button(text="URGENT\nIMPORTANT", valign='center')
uni= Button(text="URGENT\nNOT IMPORTANT", halign='center')
nui= Button(text="NOT URGENT\nIMPORTANT")
nuni= Button(text="NOT URGENT\nNOT IMPORTANT")
about_button= Button(text='MENU')
buttons= [ui,uni,nui,nuni]
for i in buttons:
options.add_widget(i)
i.bind(on_release=lambda x: setattr(self.manager, 'current', 'task_popup'))
about.add_widget(about_button)
main_screen.add_widget(options)
main_screen.add_widget(about)
self.add_widget(main_screen)
Builder.load_string(task_popup)
Builder.load_file('TaskScreen.kv')
class TestApp (App):
def build(self):
sm = ScreenManager()
sm.add_widget(MainScreen(name='main_screen'))
sm.add_widget(TaskScreen(name='task_screen'))
sm.add_widget(TaskPopup(name='task_popup'))
return sm
if __name__ == "__main__":
TestApp().run()