class Result(Screen): def __init__(self, **kwargs): super().__init__(**kwargs) self.outer = BoxLayout(orientation='vertical', padding=8, spacing=8) self.instr = ScrollLabel('', textcolor = '#000000') self.outer.add_widget(self.instr) self.add_widget(self.outer) self.on_enter = self.before def before(self): self.instr.set_text(get_result())
class Result(Screen): def __init__(self, **kwargs): super().__init__(**kwargs) self.outer = BoxLayout(orientation='vertical', padding=8, spacing=8) self.instr = ScrollLabel('', textcolor = '#FFFFFF') self.btn = Button(text='Завершить', size_hint=(0.3, 0.2), pos_hint={'center_x': 0.5}) self.btn.background_color = btn_color self.btn.on_press = self.next self.outer.add_widget(self.instr) self.outer.add_widget(self.btn) self.add_widget(self.outer) self.on_enter = self.before def before(self): self.instr.set_text(get_result()) def next(self): stopTouchApp()
class PulseScr2(Screen): def __init__(self, **kwargs): super().__init__(**kwargs) self.next_screen = False self.stage = 0 instr = ScrollLabel(txt_test3, textcolor='#FFFFFF') self.lbl1 = ScrollLabel('Считайте пульс', textcolor='#FFFFFF') self.lbl_sec = Seconds(15, textcolor='#FFFFFF') self.lbl_sec.bind(done=self.sec_finished) line0 = ColoredLayout(lcolor=(0, 0.5, 0.01, 1)) vlay = ColoredLayout(orientation='vertical', lcolor=(0.44, 0.44, 0.44, 1)) vlay.add_widget(self.lbl1) vlay.add_widget(self.lbl_sec) line0.add_widget(instr) line0.add_widget(vlay) line1 = BoxLayout(size_hint=(0.8, None), height='30sp') lbl_result1 = Label(text='Результат:', halign='right') self.in_result1 = TextInput(text='0', multiline=False) self.in_result1.set_disabled(True) line1.add_widget(lbl_result1) line1.add_widget(self.in_result1) line2 = BoxLayout(size_hint=(0.8, None), height='30sp') lbl_result2 = Label(text='Результат после отдыха:', halign='right') self.in_result2 = TextInput(text='0', multiline=False) self.in_result2.set_disabled(True) line2.add_widget(lbl_result2) line2.add_widget(self.in_result2) self.btn = Button(text='Начать', size_hint=(0.3, 0.2), pos_hint={'center_x': 0.5}) self.btn.background_color = btn_color self.btn.on_press = self.next outer = BoxLayout(orientation='vertical', padding=8, spacing=8) outer.add_widget(line0) outer.add_widget(line1) outer.add_widget(line2) outer.add_widget(self.btn) self.add_widget(outer) def sec_finished(self, instance, value): if value: if self.stage == 0: self.stage = 1 self.lbl1.set_text('Отдыхайте') self.lbl_sec.restart(30) self.in_result1.set_disabled(False) elif self.stage == 1: self.stage = 2 self.lbl1.set_text('Считайте пульс') self.lbl_sec.restart(15) elif self.stage == 2: self.in_result2.set_disabled(False) self.btn.set_disabled(False) self.btn.text = 'Завершить' self.next_screen = True def next(self): if not self.next_screen: self.btn.set_disabled(True) self.lbl_sec.start() else: global p2, p3 p2 = check_int(self.in_result1.text) p3 = check_int(self.in_result2.text) if p2 == False and p3 == False: p2 = 0 self.in_result1.text = str(p2) p3 = 0 self.in_result2.text = str(p3) elif p2 == False: p2 = 0 self.in_result1.text = str(p2) elif p3 == False: p3 = 0 self.in_result2.text = str(p3) else: self.in_result1.text = '0' self.in_result2.text = '0' self.manager.current = 'result'