def __init__(self, **kwargs): super(LeftPane, self).__init__(**kwargs) self.cols = 1 self.rows = 4 self.row_force_default = True self.row_default_height = 40 self.size_hint = (500, 0.3) self.spacing = (0, 10) Title = MDLabel() Title.text = "Quick Inch <--> MM Converter" self.InchInput = MDTextField() self.InchInput.hint_text = "Inches" self.InchInput.multiline = False self.InchInput.on_text_validate = self.convert self.MMInput = MDTextField() self.MMInput.hint_text = "Millimeters" self.MMInput.multiline = False self.MMInput.on_text_validate = self.convert ConvButton = MDRaisedButton() ConvButton.text = " <--- CONVERT --> " ConvButton.on_press = self.convert self.add_widget(Title) self.add_widget(self.InchInput) self.add_widget(self.MMInput) self.add_widget(ConvButton)
def get_text_page(self): text_card = MDCard(size_hint=(0.5, 0.9), pos_hint={'center_x': 0.25, 'center_y': 0.55}) text_label = MDLabel(disabled=True, pos_hint={'center_x': 0.5, 'center_y': 0.5}, halign='center', valign='top', theme_color='Secondary', font_style='Body1', size_hint_y=None) text_label.text = self.current_story.get_story_text() text_card.add_widget(text_label) return text_card
def get_nav_bar(self): main_bar = MDCard(size_hint=(1.0, 0.08), pos_hint={'center_x': 0.5, 'center_y': 0.05}) bar_box = BoxLayout(orientation='horizontal', padding=dp(8)) back_button = MDRaisedButton(text='Back', theme_text_color='Secondary', font_style='Title', size_hint_x=None, width=dp(36), height=self.parent.height, pos_hint={'center_x': 0.2, 'center_y': 0.5}, on_release=partial(self.prev_page)) title_label = MDLabel(disabled=True, theme_text_color='Primary', halign='center', height=self.parent.height, pos_hint={'center_x': 0.2, 'center_y': 0.5}) title_label.text = self.current_story.title next_button = MDRaisedButton(text='Next', theme_text_color='Secondary', font_style='Title', size_hint_x=None, width=dp(36), height=self.parent.height, pos_hint={'center_x': 0.2, 'center_y': 0.5}, on_release=partial(self.next_page)) bar_box.add_widget(back_button) bar_box.add_widget(title_label) bar_box.add_widget(next_button) main_bar.add_widget(bar_box) return main_bar