def user_screen(self): self.manager.get_screen( 'main').ids.btn_camera.color = get_color_from_hex('#FFFFFF') self.manager.get_screen( 'main').ids.btn_home.color = get_color_from_hex('#FFFFFF') self.manager.get_screen( 'main').ids.btn_user.color = get_color_from_hex('#2196F3') self.manager.get_screen('main').ids.master.clear_widgets() user_layout = GridLayout() user_layout.id = 'user_layout' user_layout.spacing = (0, 0.5) user_layout.padding = 40, 10, 40, 10 user_layout.cols = 1 user_layout.row_default_height = self.height * 0.25 user_layout.row_force_default = True lbl_user = Label() lbl_user.id = 'lbl_home' lbl_user.color = get_color_from_hex('#212121') lbl_user.text = 'User Layout' self.manager.get_screen('main').ids[user_layout.id] = \ WeakProxy(user_layout) self.manager.get_screen('main').ids[lbl_user.id] = \ WeakProxy(lbl_user) self.manager.get_screen('main').ids.master.\ add_widget(user_layout) self.manager.get_screen('main').ids.user_layout.\ add_widget(lbl_user)
def home_screen(self): self.manager.get_screen( 'main').ids.btn_camera.color = get_color_from_hex('#FFFFFF') self.manager.get_screen( 'main').ids.btn_home.color = get_color_from_hex('#2196F3') self.manager.get_screen( 'main').ids.btn_user.color = get_color_from_hex('#FFFFFF') self.manager.get_screen('main').ids.master.clear_widgets() home_layout = GridLayout() home_layout.id = 'home_layout' home_layout.spacing = (0, 0.5) home_layout.padding = 40, 10, 40, 10 home_layout.cols = 1 home_layout.row_default_height = self.height * 0.25 home_layout.row_force_default = True lbl_home = Label() lbl_home.id = 'lbl_home' lbl_home.color = get_color_from_hex('#212121') lbl_home.text = 'Home Layout' self.manager.get_screen('main').ids[home_layout.id] = \ WeakProxy(home_layout) self.manager.get_screen('main').ids[lbl_home.id] = \ WeakProxy(home_layout) self.manager.get_screen('main').ids.master.\ add_widget(home_layout) self.manager.get_screen('main').ids.lbl_home.\ add_widget(lbl_home)
def camera_screen(self): self.manager.get_screen( 'main').ids.btn_camera.color = get_color_from_hex('#2196F3') self.manager.get_screen( 'main').ids.btn_home.color = get_color_from_hex('#FFFFFF') self.manager.get_screen( 'main').ids.btn_user.color = get_color_from_hex('#FFFFFF') self.manager.get_screen('main').ids.master.clear_widgets() camera_layout = GridLayout() camera_layout.id = 'camera_layout' camera_layout.spacing = (0, 0.5) camera_layout.padding = 40, 10, 40, 10 camera_layout.cols = 1 camera_layout.row_default_height = self.height * 0.25 camera_layout.row_force_default = True lbl_camera = Label() lbl_camera.id = 'lbl_camera' lbl_camera.color = get_color_from_hex('#212121') lbl_camera.text = 'Camera Layout' self.manager.get_screen('main').ids[camera_layout.id] = \ WeakProxy(camera_layout) self.manager.get_screen('main').ids[lbl_camera.id] = \ WeakProxy(lbl_camera) self.manager.get_screen('main').ids.master.\ add_widget(camera_layout) self.manager.get_screen('main').ids.camera_layout.\ add_widget(lbl_camera)
def listgrades(self, instance): self.clear() mylayout = self.ids['mylayout'] mylayout.cols = 3 self.assignmentID = int(instance.text) global coursenum grades = repo.getGradesForAssignment(coursenum, self.assignmentID) if grades: label = Label(text='Student Username') label.size_hint_y = None mylayout.add_widget(label) label = Label(text='GradePoint for ' + str(self.assignmentID)) label.size_hint_y = None mylayout.add_widget(label) label = Label(text='') label.id = 'msg' label.size_hint_y = None self.newids.append(label) mylayout.add_widget(label) for grade in grades: label = Label(text=grade.username) label.size_hint_y = None label.id = grade.username + 'lbl' self.newids.append(label) mylayout.add_widget(label) text = TextInput(text=str(grade.point)) text.size_hint_y = None text.id = grade.username + 'txt' self.newids.append(text) mylayout.add_widget(text) gradebtn = Button(text='Submit') gradebtn.id = grade.username + 'btn' gradebtn.size_hint_y = None gradebtn.bind(on_press=self.submitgrades) mylayout.add_widget(gradebtn) close = Button(text='Back') close.size_hint_y = None close.bind(on_press=self.close) mylayout.add_widget(close)
def __init__(self, **kwargs): super().__init__(**kwargs) self.cols = 1 self.spacing = 10 self.padding = 10 label_list = ['Собака', 'Сосед', 'Кот', 'Биткоин'] for i, title in enumerate(label_list): label = Label(text=title) label.id = 'id:' + str(i) self.add_widget(label)
def getCellLabel(self,fila,columna,Texto,Halign='left',Disabled = False,Size=200,Tipo="txt",Valign='middle'): """Funcion que devuelve una celda completa para manejo de etiquitas""" cell = GridRow() cell.id = "row{0}_col{1}".format(fila,columna) if Tipo == "key": cell.key = Texto cell.width = Size clabel = Label() clabel.id=Tipo clabel.padding=[5,5] clabel.text='[color=000000]{0}[/color]'.format(Texto) clabel.halign=Halign clabel.valign=Valign clabel.disabled=Disabled clabel.markup=True clabel.text_size=cell.size cell.add_widget(clabel) return cell
def _AddMessage(self, h: float) -> Label: label = Label(text="", font_size="12sp", size_hint=(1, h), color=(1, 0.5, 0.5, 1)) label.id = "message" AlignWidgetLabelChildren(label, valign="top") return label
def _AddFailureType(self, h: float) -> Label: label = Label(text="", font_size="18sp", size_hint=(1, h), color=(1, 0.5, 0.5, 1)) label.id = "type" return label