How to use the kivy.uix.label.Label function in Kivy

To help you get started, we’ve selected a few Kivy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ODiogoSilva / TriFusion / trifusion / data / resources / custom_widgets.py View on Github external
#             return
#         self.border_point = pos
#         self.hovered = inside
#         if inside:
#             self.dispatch('on_enter')
#         else:
#             self.dispatch('on_leave')
#
#     def on_enter(self):
#         pass
#
#     def on_leave(self):
#         pass


class LinkedLabel(Label):
    """
    Modification of label to reformat label for path linking
    """

    def __init__(self, **kwargs):
        super(LinkedLabel, self).__init__(**kwargs)

    @staticmethod
    def create_ref_label(text):
        """
        Modifies the original label by adding references to each directory in
        the path
        """

        if sys.platform in ["win32", "cygwin"]:
            s = p = ""
github osava-nsit / osava / osask.py View on Github external
def draw_wait_queue(self, wait_box, status_box, wait_to_memory_box, start_height, temp_memory, *args):
        wait_queue = temp_memory['processes_waiting']
        event_details = temp_memory['event']
        process_id,arrival_bit,curr_time,burst_time,process_size = event_details
        wait_to_memory = temp_memory['wait_to_memory']
        external_fragmentation = temp_memory['external_fragmentation']

        wait_flag=0 # to check whether process was added to the wait queue

        label = Label(text='Wait Queue: ', size_hint_x=None, width=self.margin_left, valign='top', halign='center')
        label.text_size = label.size
        wait_box.add_widget(label)

        s_label = Label(text='Status: ', size_hint_x=None, width=self.margin_left, valign='top', halign='center')
        s_label.text_size = s_label.size
        status_box.add_widget(s_label)

        wm_label = Label(text='Processes loaded into memory from wait queue: ', size_hint_x=None, width=self.margin_left  + kivy.metrics.dp(230), valign='top', halign='center')
        wm_label.text_size = wm_label.size
        wait_to_memory_box.add_widget(wm_label)

        if not wait_queue:
            w_label = Label(text='Empty', size_hint_x=None, width='50dp', halign='left', valign='top')
            w_label.text_size = w_label.size
            wait_box.add_widget(w_label)
github osava-nsit / osava / screens / cpu_screens.py View on Github external
self.multilevel_input_widgets.append(box)

            box = BoxLayout(orientation='horizontal', size_hint_y=None, height=form_row_height)
            label = Label(text='Queue number')
            box.add_widget(label)
            label = Label(text='Algorithm chosen')
            box.add_widget(label)
            label = Label(text='Time quantum (ms)')
            box.add_widget(label)
            grid_layout.add_widget(box)
            self.multilevel_input_widgets.append(box)

            # Adding input rows for intra queue scheduling algorithm for each queue 
            for i in range(data_cpu['num_queues']):
                box = BoxLayout(orientation='horizontal', padding=(kivy.metrics.dp(25),0), size_hint_y=None, height=form_row_height)
                qnum = Label(text='Q'+str(i+1))
                box.add_widget(qnum)

                data_cpu['qnum'+str(i)] = 'Q'+str(i+1)
             
                queue_spinner = Spinner(
                    text='-',
                    values=('FCFS','Round Robin'),
                    padding=(kivy.metrics.dp(50), 0))
                box.add_widget(queue_spinner)

                inp = TextInput(id='queue_quantum'+str(i), disabled=True)
                inp.bind(text=partial(cpu_on_queue_quantum, i=i))
                box.add_widget(inp)

                queue_spinner.bind(text=partial(self.set_queue_type, inp=inp, idx=i))
github kivy / kivy / examples / widgets / settings.py View on Github external
buttons = BoxLayout(orientation='horizontal')
        buttons.add_widget(sidebar_button)
        buttons.add_widget(spinner_button)
        buttons.add_widget(tabbed_button)

        displaytype = Label(text='How to display the settings?')
        display_buttons = BoxLayout(orientation='horizontal')
        onwin_button = Button(text='on window')
        onwin_button.bind(on_press=lambda j: self.set_display_type('normal'))
        popup_button = Button(text='in a popup')
        popup_button.bind(on_press=lambda j: self.set_display_type('popup'))
        display_buttons.add_widget(onwin_button)
        display_buttons.add_widget(popup_button)

        instruction = Label(text='Click to open the settings panel:')
        settings_button = Button(text='Open settings')
        settings_button.bind(on_press=self.open_settings)

        layout = BoxLayout(orientation='vertical')
        layout.add_widget(paneltype)
        layout.add_widget(buttons)
        layout.add_widget(displaytype)
        layout.add_widget(display_buttons)
        layout.add_widget(instruction)
        layout.add_widget(settings_button)

        return layout
github oOo0oOo / RocketKite / main.py View on Github external
btn.background_down = ''
        main_l.add_widget(btn)

        # Reset highscore
        btn = Button(text = 'RESET HIGHSCORE (double tap)', on_press = self.reset_highscore,
            size_hint_y = None,
            height = btn_h,
            font_size = 40 * s,
            color = colors[0])
        btn.background_color = (0.6,0.1,0.1,1.0)
        btn.background_normal = ''
        btn.background_down = ''
        main_l.add_widget(btn)

        # Credits
        credits = Label(text = 'CODE & ART: Oliver Dressler', font_size = 40 * s, size_hint_y = None,
            height = std_h,
            color = colors[8])
        main_l.add_widget(credits)

        # Return btn
        btn = Button(text = 'return', on_press = self.return_to_main,
            size_hint_y = None,
            height = btn_h,
            font_size = 40 * s,
            color = colors[0])
        btn.background_color = colors[5]
        btn.background_normal = ''
        btn.background_down = ''
        main_l.add_widget(btn)
        self.add_widget(main_l)
github chaosbuffalolabs / ParticlePanda / cbl_gui_elements.py View on Github external
def setup_window(self,dt):
        if self.text == '[blank]':
            with self.canvas:
                Color(*self.color)
                Line(points= (self.x,self.y,self.x,self.top, self.right, self.top, self.right, self.y, self.x, self.y), dash_length = 5, dash_offset = 2)

            self.label = Label(text='Add an item...', text_size=(self.width-25,18), size = (self.width-20,20), color=self.color, pos = (self.x+5, self.y), size_hint = (None,None))
            self.remove_icon = None
            self.add_widget(self.label)

        else:
            with self.canvas:
                Color(*self.color)
                Rectangle(pos=self.pos, size=self.size)

            self.label = Label(text=self.text, text_size=(self.width-25,20), size = (self.width-20,20), color=self.text_color, pos = (self.x+5, self.y), size_hint = (None,None))
            self.remove_icon = Image(source='Assets/remove.png',pos = (self.x + self.width - 20, self.y), size = (20,20), size_hint = (None,None))
            self.add_widget(self.label)
            self.add_widget(self.remove_icon)
github mahart-studio / kivystudio / kivystudio / components / topmenu / __init__.py View on Github external
def decide_drop(self, dt):
        if not self.dropdown.hover:
            self.dropdown.dismiss()

    def drop_menu(self, menu_name, index):
        if not hasattr(self, menu_name):
            setattr(self, menu_name, getattr(dropmenu, menu_name)())
        
        menu = getattr(self, menu_name)
        if menu.parent:
            menu.parent.remove_widget(menu)
        menu.open(self.children[index])


class TopMenuItem(HoverBehavior, ButtonBehavior, Label):

    def on_hover(self, *args):
        if self.hover:
            self.text = "[u]" + self.text + "[/u]"
            self.color = (.1,.1,.1,1)
                
        else:
            self.text = self.text.replace('[u]','').replace('[/u]','')
            self.color = (0,0,0,1)
            


Builder.load_string('''
github kivy / pyobjus / examples / background_transfer.py View on Github external
def build(self):
        return Label(text="Background Transfer Demo.\nFor iOS 8 or later.")
github BenjiLee / PoloniexAnalyzer / gui.py View on Github external
def col1_on_enter(instance):
            self.difference1 = 0
            self.previous1 = 0
            self.col1_current.text = str(0)
            self.col1_total_change.text = str(0)
            self.col1_percent.text = "0%"
            self.col1_change.text = str(0)
            self.col1_volume.text = str(0)

        self.col1_ticker_input = TextInput(text='BTC_DASH', multiline=False)
        self.col1_ticker_input.bind(on_text_validate=col1_on_enter)

        self.col1_current_title = Label(text='Current:')
        self.col1_current = Label(text='0', font_size='18sp')
        self.col1_change_title = Label(text='Last Change:')
        self.col1_change = Label(text='0', markup=True, font_size='18sp')
        self.col1_total_change_title = Label(text='Total Change:')
        self.col1_total_change = Label(text='0', markup=True, font_size='18sp')
        self.col1_percent_title = Label(text='Percent Change:')
        self.col1_percent = Label(text='0', markup=True, font_size='18sp')
        self.col1_volume_title = Label(text='Volume:')
        self.col1_volume = Label(text='0', markup=True, font_size='18sp')

        def callback_col1_difference(instance, value):
            self.difference1 = 0
            self.col1_total_change.text = str(0)
            self.col1_percent.text = "0%"
            self.col1_volume.text = str(0)

        self.col1_reset_button = Button(text='Reset', font_size=14)
        self.col1_reset_button.bind(state=callback_col1_difference)