Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Ruffier App, with notes :) - Ms. Suraya
- # All of the imports!
- from kivy.app import App
- from kivy.uix.screenmanager import ScreenManager, Screen
- from kivy.uix.boxlayout import BoxLayout
- from kivy.uix.label import Label
- from kivy.uix.button import Button
- from kivy.uix.textinput import TextInput
- from kivy.core.window import Window
- from kivy.uix.scrollview import ScrollView
- from instructions import txt_instruction, txt_test1, txt_test2, txt_test3, txt_sits
- from ruffier import test
- # Variables to store all the default settings for the text boxes
- age = 7
- name = ""
- p1, p2, p3 = 0, 0, 0
- # Instruction screen 🖥️
- # Instructions are taken from instructions.py
- # There are two pairs of Labels and TextInput
- # Label 1 + TextInput --- User enters name
- # Label 2 + TextInput --- User enters age
- # There is one button "Start" that will take the user to the next step
- class InstrScr(Screen):
- def __init__(self, **kwargs):
- super().__init__(**kwargs)
- instr = Label(text=txt_instruction)
- lbl1 = Label(text='Enter the name:', halign='right')
- self.in_name = TextInput(multiline=False)
- lbl2 = Label(text='Enter the age:', halign='right')
- self.in_age = TextInput(text='7', multiline=False)
- self.btn = Button(text='Start', size_hint=(0.3, 0.2), pos_hint={'center_x': 0.5})
- self.btn.on_press = self.next
- line1 = BoxLayout(size_hint=(0.8, None), height='30sp')
- line2 = BoxLayout(size_hint=(0.8, None), height='30sp')
- line1.add_widget(lbl1)
- line1.add_widget(self.in_name)
- line2.add_widget(lbl2)
- line2.add_widget(self.in_age)
- outer = BoxLayout(orientation='vertical', padding=8, spacing=8)
- outer.add_widget(instr)
- outer.add_widget(line1)
- outer.add_widget(line2)
- outer.add_widget(self.btn)
- self.add_widget(outer)
- def next(self):
- global name
- name = self.in_name.text
- self.manager.current = 'pulse1'
- # Pulse measuring screen! 💓
- # Intructions are from instructions.py
- # Label + TextInput --- to enter measured pulse (Resting)
- # One button to take user to the next step
- class PulseScr(Screen):
- def __init__(self, **kwargs):
- super().__init__(**kwargs)
- instr = Label(text=txt_test1)
- line = BoxLayout(size_hint=(0.8, None), height='30sp')
- lbl_result = Label(text='Enter the result:', halign='right')
- self.in_result = TextInput(text='0', multiline=False)
- line.add_widget(lbl_result)
- line.add_widget(self.in_result)
- self.btn = Button(text='Next', size_hint=(0.3, 0.2), pos_hint={'center_x': 0.5})
- self.btn.on_press = self.next
- outer = BoxLayout(orientation='vertical', padding=8, spacing=8)
- outer.add_widget(instr)
- outer.add_widget(line)
- outer.add_widget(self.btn)
- self.add_widget(outer)
- def next(self):
- global p1
- p1 = int(self.in_result.text)
- self.manager.current = 'sits'
- # SQUAT SQUAT SQUAT
- # Shows instructions from instructions.py
- # Signals the user to squat 30 times in 45 seconds
- # Note: No timers yet!
- # One button to go to the next screen
- class CheckSits(Screen):
- def __init__(self, **kwargs):
- super().__init__(**kwargs)
- instr = Label(text=txt_sits)
- self.btn = Button(text='Next', size_hint=(0.3, 0.2), pos_hint={'center_x': 0.5})
- self.btn.on_press = self.next
- outer = BoxLayout(orientation='vertical', padding=8, spacing=8)
- outer.add_widget(instr)
- outer.add_widget(self.btn)
- self.add_widget(outer)
- def next(self):
- self.manager.current = 'pulse2'
- # Final pulse readings 💓
- # Instructions are taken from... you guessed it: instructions.py
- # There are two pairs of Labels and TextInput
- # Label 1 + TextInput --- Pulse right after all the squats
- # Label 2 + TextInput --- Pulse taken again after resting
- # One button "Finalise" that will take the user to the next step
- class PulseScr2(Screen):
- def __init__(self, **kwargs):
- pass
- def next(self):
- pass
- # Results screen 🖥️
- # Displays Name, Ruffier Index and Heart Efficiency
- class Result(Screen):
- def __init__(self, **kwargs):
- pass
- def before(self):
- pass
- # Tying it all together!
- class HeartCheck(App):
- def build(self):
- pass
- # Run the app ✨
- app = HeartCheck()
- app.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement