python类Label()的实例源码

AndroidKivyApp_Letters2Words.py 文件源码 项目:FunUtils 作者: HoussemCharf 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self,**kwargs):
        super(WordUI, self).__init__(**kwargs)
        self.cols=2
        #adding text label
        self.add_widget(Label(text="insert the words:"))
        #adding text Input
        self.letttersinput = TextInput(multiline=False)
        self.add_widget(self.letttersinput)
        #adding the action button
        self.add_widget(Button(text="Generate", on_press=self.game , pos=(50, 100)))
loginscreen.py 文件源码 项目:POS-System 作者: obernardovieira 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, **kwargs):
        super(LoginScreen, self).__init__(**kwargs)
        '''self.orientation = 'vertical'
        ###
        self.grid = GridLayout()
        self.grid.cols = 2
        self.grid.add_widget(Label(text='User Name'))
        self.grid.username = TextInput(multiline=False)
        self.grid.add_widget(self.grid.username)
        self.grid.add_widget(Label(text='password'))
        self.grid.password = TextInput(multiline=False)
        self.grid.add_widget(self.grid.password)
        ###
        self.options = BoxLayout()
        self.options.size_hint_y = 0.5
        self.options.bt_cancel = Button(text='Cancel')
        self.options.add_widget(self.options.bt_cancel)
        self.options.bt_login = Button(text='Login')
        self.options.bt_login.bind(on_press=self.bt_login_clicked)
        self.options.add_widget(self.options.bt_login)
        ###
        self.add_widget(self.grid)
        self.add_widget(self.options)'''

    ###
loginscreen.py 文件源码 项目:POS-System 作者: obernardovieira 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def bt_login(self):

        row = self.root_self.database.isValidLogin(self.username.text, self.password.text)

        if(row == None):
            content = Label(text = 'Username or Password incorrect!')
            popup = Popup(
                        title           = 'User Login',
                        content         = content,
                        size_hint       = (None, None),
                        size            = (400, 100)
                    )

            # open the popup
            popup.open()
            return
        #
        self.root_self.pos_system.setUserName(self.username.text)
        self.root_self.pos_system.setUserID(row[0])
        self.root_self.database.registerLogs(self.root_self.pos_system.getUserID(), 0)
        #
        self.root_self.loadBarOptions()
        self.root_self.loadMainWindow()
        #
        self.root_self.a_price.label_price = Label(text = '0€')
        self.root_self.a_price.add_widget(self.root_self.a_price.label_price)
        #
        self.root_self.popup.dismiss()

    ###
controller.py 文件源码 项目:POS-System 作者: obernardovieira 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def loadMainWindow(self, obj = None):

        self.atual_menu = 0
        op_n = 1
        mainOptions = [APPERTIZERS_NAME, MEAT_NAME, FISH_NAME, VEGAN_NAME, DRINKS_NAME, DESSERT_NAME]

        self.a_articles.clear_widgets()

        for op in mainOptions:
            button = Button(text=op)
            button.bind(on_press=self.openNewMenu)
            op_n = op_n + 1
            self.a_articles.add_widget(button)

        for a in range(op_n-1, 9):
            self.a_articles.add_widget(Label(text=''))

        self.bt_next.enabled = False
        self.bt_previous.enabled = False

        if(self.pos_system.getBuyList() == None):
            self.bt_newlist.enabled = True
            self.bt_clearlist.enabled = False
            self.bt_finishlist.enabled = False

        self.menu_page = 0

    ###
controller.py 文件源码 项目:POS-System 作者: obernardovieira 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def openNewMenu(self, obj):
        op_n = 1
        total_rows = 0
        if obj != self.bt_next and obj != self.bt_previous:
            self.menu_type = obj.text.lower()

        cursor = self.database.loadArticles(self.menu_type, self.menu_page)

        self.a_articles.clear_widgets()

        for row in cursor:
            total_rows = total_rows + 1
            if(total_rows > 9) : break
            button = Button(text=row[1])
            button.bind(on_press=self.addToBuyList)
            button.item = Item(id_p = row[0], name = row[1], price = row[2], tax = 0.2)
            op_n = op_n + 1
            self.a_articles.add_widget(button)

        for a in range(op_n-1, 9):
            self.a_articles.add_widget(Label(text=''))

        if(total_rows > 9):
            self.bt_next.enabled = True
        else:
            self.bt_next.enabled = False

        if(self.menu_page > 0):
            self.bt_previous.enabled = True
        else:
            self.bt_previous.enabled = False

    ###
10.finalApp_Hacking_UI_and_shell_root_access.py 文件源码 项目:Python_For_Android_Hacking 作者: priyankgada 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def progbar(self):
        pb = ProgressBar()
        popup = Popup(title='Brute Forcing... Do NOT Close This Window!', content=pb, size_hint=(0.7, 0.3))
        popup.open()
        time.sleep(2)
        pb.value = 25
        time.sleep(4)
        pb.value = 50
        time.sleep(6)
        pb.value = 75
        time.sleep(8)
        pb.value = 100

        popup = Popup(title="Password Not Found!",content=Label(text="Password Not Found in our dictionary, give it a try later"),size_hint=(0.7,0.3))
        popup.open()
10.finalApp_Hacking_UI_and_shell_root_access.py 文件源码 项目:Python_For_Android_Hacking 作者: priyankgada 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def do_action2(self, *args):
        if self.user_input2=='': # user enter no value
            popup = Popup(title="Profile Name Can't Be empty!",content=Label(text="Profile Name Format ie Hussam Khrais"),size_hint=(0.7,0.3))
            popup.open()
            return

        threading.Thread(target=self.progbar).start()
        return
10.finalApp_Hacking_UI_and_shell_root_access.py 文件源码 项目:Python_For_Android_Hacking 作者: priyankgada 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def progbar(self):
        pb = ProgressBar()
        popup = Popup(title='Searching in DB... Do NOT Close This Window!', content=pb, size_hint=(0.7, 0.3))
        popup.open()
        time.sleep(2)
        pb.value = 25
        time.sleep(4)
        pb.value = 50
        time.sleep(6)
        pb.value = 75
        time.sleep(8)
        pb.value = 100
        popup = Popup(title="Password Not Found!",content=Label(text="Double check profile name OR try brute force option!"),size_hint=(0.7,0.3))
        popup.open()
10.finalApp_Hacking_UI_and_shell_root_access.py 文件源码 项目:Python_For_Android_Hacking 作者: priyankgada 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def do_action(self, *args):

        if self.user_input=='': # user enter no value
            popup = Popup(title="Profile Name Can't Be empty!",content=Label(text="Profile Name Format ie Hussam Khrais"),size_hint=(0.7,0.3))
            popup.open()
            return
        threading.Thread(target=self.progbar).start()
        return
screens.py 文件源码 项目:ninety_per_ten 作者: arruda 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def _build_botton_box(self):
        botton_box = BoxLayout(orientation='vertical', spacing=10)
        self.total_label = Label(font_size=30, color=[0, 0, 0, 1], size_hint=(1, 1))

        botton_box.add_widget(self.total_label)
        botton_box.add_widget(self._build_evaluation_box())
        return botton_box
screens.py 文件源码 项目:ninety_per_ten 作者: arruda 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def _build_top_box(self):
        top_box = BoxLayout(orientation='vertical')

        self.positive_label = Label(text="0%", font_size=150, color=rgb_to_kivy(239, 93, 5, 1), size_hint=(1, 1))

        top_box.add_widget(self._build_menu_and_reset())
        top_box.add_widget(self.positive_label)
        return top_box
bg_screen.py 文件源码 项目:glucometer 作者: johnyburd 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def display_BG(self, value):
        popup = Popup(title='BG',
        content=Label(text=value,font_size=25),
        size_hint=(None, None), size=(125, 125))
        popup.bind(on_dismiss=self.dismiss_both)
        popup.open()
main.py 文件源码 项目:cloud-clipboard 作者: krsoninikhil 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, **kwargs):
        super(LoginScreen, self).__init__(**kwargs)
        self.username_w = TextInput(multiline=False)
        self.password_w = TextInput(password=True, multiline=False)
        self.login_btn = Button(text='Login')
        self.login_btn.bind(on_press=self.login)

        layout = GridLayout()
        layout.cols = 2
        layout.add_widget(Label(text='Username'))
        layout.add_widget(self.username_w)
        layout.add_widget(Label(text='Password'))
        layout.add_widget(self.password_w)
        layout.add_widget(self.login_btn)
        self.add_widget(layout)
main.py 文件源码 项目:cloud-clipboard 作者: krsoninikhil 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def show_failure(self, req, res):
        if req.resp_status / 100 == 4:
            self.add_widget(Label(text='Invalid username/password. See readme to register.'))
uiObj.py 文件源码 项目:caltrac 作者: shiburizu 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def newFoodIns(self,delta):
        t = date.today() - timedelta(delta)
        try:
            realKcal = float(self.kcalInp.text)*float(self.portionInp.text)
            c.execute("INSERT INTO foods(name,date,kcal,portion) VALUES(?,?,?,?);",
                (self.foodInp.text,t,realKcal,int(self.portionInp.text)))
            db.commit()
            CalApp.updateJournal(delta)
            CalApp.sm.current = 'Root'
        except ValueError:
            invalid = Popup(title='Invalid entries',
                content=Label(text='Check your data and try again.'),
                size_hint=(None, None),size=('250dp','150dp'))
            invalid.open()
uiObj.py 文件源码 项目:caltrac 作者: shiburizu 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def setup2(self):
        try:
            CalApp.inp = [self.nameInp.text.strip(' \t\n\r'),
                float(self.heightInp.text),
                float(self.weightInp.text),int(self.yearsInp.text),
                self.genderChoice]
            CalApp.sm.current='Profile2'

        except (TypeError,ValueError) as e:
            invalid = Popup(title='Invalid entries',
                content=Label(text='Check your data and try again.'),
                size_hint=(None, None),size=('250dp','150dp'))
            invalid.open()
gap.py 文件源码 项目:GAP 作者: Tileyon 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def unilabel(self, params):
        self.unilabels.append([])
        if self.kivy:
            from kivy.uix.label import Label
            self.unilabels[len(self.unilabels) - 1] = Label(pos = \
                (params[0] * self.xratio, params[1] * self.yratio), \
                size_hint=(1.0,1.0), halign="left", \
                valign="bottom", text = params[4])
            self.unilabels[len(self.unilabels) - 1].font_size = 17.5 * \
                self.yratio
            self.unilabels[len(self.unilabels) - 1].bind(size= \
                self.unilabels[len(self.unilabels) - 1].setter('text_size'))
            self.root.add_widget(self.unilabels[len(self.unilabels) - 1])

        else:

            import ui
            self.unilabels[len(self.unilabels) - 1] = ui.Label(frame= \
                (params[0] * self.xratio,  (600 - params[1] - params[3]) * \
                self.yratio, params[2] * self.xratio, params[3] * self.yratio))
            self.unilabels[len(self.unilabels) - 1].text = params[4]
            self.unilabels[len(self.unilabels) - 1].text_color = 'white'
            self.unilabels[len(self.unilabels) - 1].alignment = \
                ALIGN_LEFT = True
            self.unilabels[len(self.unilabels) - 1].font = ('<system>', 18 * \
                self.xratio)
            self.root.add_subview(self.unilabels[len(self.unilabels) - 1])
gap12.py 文件源码 项目:GAP 作者: Tileyon 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def unilabel(self, params):
        self.unilabels.append([])
        if self.kivy:
            from kivy.uix.label import Label
            self.unilabels[len(self.unilabels) - 1] = Label(pos = \
                (params[0] * self.xratio, params[1] * self.yratio), \
                size_hint=(1.0,1.0), halign="left", \
                valign="bottom", text = params[4])
            self.unilabels[len(self.unilabels) - 1].font_size = 17.5 * \
                self.yratio
            self.unilabels[len(self.unilabels) - 1].bind(size= \
                self.unilabels[len(self.unilabels) - 1].setter('text_size'))
            self.root.add_widget(self.unilabels[len(self.unilabels) - 1])

        else:

            import ui
            self.unilabels[len(self.unilabels) - 1] = ui.Label(frame= \
                (params[0] * self.xratio,  (600 - params[1] - params[3]) * \
                self.yratio, params[2] * self.xratio, params[3] * self.yratio))
            self.unilabels[len(self.unilabels) - 1].text = params[4]
            self.unilabels[len(self.unilabels) - 1].text_color = 'white'
            self.unilabels[len(self.unilabels) - 1].alignment = \
                ui.ALIGN_LEFT
            self.unilabels[len(self.unilabels) - 1].font = ('<system>', 18 * \
                self.yratio)
            self.root.add_subview(self.unilabels[len(self.unilabels) - 1])
gap21.py 文件源码 项目:GAP 作者: Tileyon 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def unilabel(self, params):
        self.unilabels.append([])
        if self.kivy:
            from kivy.uix.label import Label
            self.unilabels[len(self.unilabels) - 1] = Label(pos = \
                (params[0] * self.xratio, params[1] * self.yratio), \
                size_hint=(1.0,1.0), halign="left", \
                valign="bottom", text = params[4])
            self.unilabels[len(self.unilabels) - 1].font_size = 17.5 * \
                self.yratio
            self.unilabels[len(self.unilabels) - 1].bind(size= \
                self.unilabels[len(self.unilabels) - 1].setter('text_size'))
            self.root.add_widget(self.unilabels[len(self.unilabels) - 1])

        else:

            import ui
            self.unilabels[len(self.unilabels) - 1] = ui.Label(frame= \
                (params[0] * self.xratio,  (600 - params[1] - params[3]) * \
                self.yratio, params[2] * self.xratio, params[3] * self.yratio))
            self.unilabels[len(self.unilabels) - 1].text = params[4]
            self.unilabels[len(self.unilabels) - 1].text_color = 'white'
            self.unilabels[len(self.unilabels) - 1].alignment = \
                ui.ALIGN_LEFT
            self.unilabels[len(self.unilabels) - 1].font = ('<system>', 18 * \
                self.yratio)
            self.root.add_subview(self.unilabels[len(self.unilabels) - 1])
assemble.py 文件源码 项目:AssembleAudio 作者: The-White-Wolf 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def edit_row(self, index, data_to_write):
        if len(data_to_write) != self.cols:
            print('--Edit Row:  Data mismatch error.')
            popup = Popup(title='Grid Error 01',
                    content=Label(text = 'There was a problem in updating the grid.'),
                    size_hint = (0.3, 0.3))
            popup.open()
        else:
            end = len(self.children) - (index * self.cols)
            start = end - self.cols
            #Update the selected file's info too.
            if self.children[start].text == self._sel_file:
                self._sel_file = data_to_write[-1]
            for i, widget in enumerate(reversed(self.children[start:end])):
                widget.text = data_to_write[i].strip()


问题


面经


文章

微信
公众号

扫码关注公众号