def build(self): main_layout = BoxLayout(padding=(10, 0), orientation="vertical") wimg = Image(source='s.png') wimg.allow_stretch = True wimg.keep_ratio = False wimg.size_hint_x = 1 wimg.size_hint_y = 0.2 scroll_container = BoxLayout(orientation="vertical", size_hint=(1, 0.90)) self.layout = BoxLayout(padding=(15, 10), orientation="vertical", spacing=50, size_hint_y=None) self.layout.bind(minimum_height=self.layout.setter('height')) colors = [red, green, blue, purple] root = ScrollView(size_hint=(1, None), size=(Window.width, Window.height * 0.70)) root.add_widget(self.layout) bottom_layout = BoxLayout(padding=10, orientation="horizontal", size_hint=(1, 0.1)) self.textinput = TextInput(hint_text="Say something ", background_color=random.choice(colors), size_hint=(0.8, 1)) btn3 = Button(text="Send", background_color=random.choice(colors), size_hint=(0.2, 1)) btn3.bind(on_press=self.sent) bottom_layout.add_widget(self.textinput) bottom_layout.add_widget(btn3) scroll_container.add_widget(root) main_layout.add_widget(wimg) main_layout.add_widget(scroll_container) main_layout.add_widget(bottom_layout) Window.bind(on_key_down=self.on_key_down) btn = Label(padding=(0, 0), text="Bot> " + random.choice(ice_breakers), color=(1, 0, 1, 1), size_hint=(1.0, 1.0), halign="left", valign="middle") btn.bind(size=btn.setter('text_size')) self.layout.add_widget(btn) return main_layout
def __init__(self, **kwargs): super().__init__(**kwargs) self.orientation = 'vertical' # Main screen layout screen_layout = MDGridLayout() screen_layout.cols = 2 screen_layout.md_bg_color = [0, 1, 1, 1] # AC region self.timer = 0 new_layout = MDFloatLayout() self.new_card = MDCard( orientation='vertical', padding='10dp', pos_hint={ 'center_x': 0.5, 'center_y': 0.5 }, size_hint=(0.75, 0.75), ) self.new_card.md_bg_color = app.off_red ac_image = Image(source='static/ac1.png', ) ac_image.size_hint_y = 0.9 ac_image.pos_hint = {'top': 1.0, 'center_x': 0.5} self.new_card.radius = [4] * 4 # ac_button.bind(active=callback) self.new_card.add_widget(ac_image) self.new_card.on_press = self.ac_touch_down self.new_card.on_release = self.ac_touch_up temp = MDLabel(text='18ºC') temp.font_size = 10 temp.size = (0.25, 1) temp.color = [1, 1, 1, 1] new_layout.add_widget(self.new_card) screen_layout.add_widget(new_layout) self.ac_popup = Popup(title='AC settings', content=AcFeatures(), size_hint=(0.75, 0.75)) self.ac_popup.background_color = [i / 255 for i in [137, 205, 211]] + [1] #self.ac_popup.on_open = self.faltu #--------------------------------------------------------------# # Light setup new_layout = MDFloatLayout() self.light_card = MDCard( orientation='horizontal', padding='10dp', pos_hint={ 'center_x': 0.5, 'center_y': 0.5 }, size_hint=(0.75, 0.75), ) self.light_card.md_bg_color = app.dark_color light_image = Image( source='static/light1.png', size_hint=(1, 1), ) self.light_card.on_press = self.light_change self.light_card.add_widget(light_image) new_layout.add_widget(self.light_card) screen_layout.add_widget(new_layout) screen_layout.add_widget(Button(text='TODO')) screen_layout.add_widget(Button(text='TODO')) screen_layout.add_widget(Button(text='TODO')) screen_layout.add_widget(Button(text='TODO')) screen_layout.add_widget(Button(text='TODO')) screen_layout.add_widget(Button(text='TODO')) self.add_widget(screen_layout)