Python kivy.uix.boxlayout 模块,BoxLayout() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用kivy.uix.boxlayout.BoxLayout()

项目:kivy-tutorials    作者:inclement    | 项目源码 | 文件源码
def build(self):
        root_widget = BoxLayout(orientation='vertical')

        output_label = Label(size_hint_y=1)  

        button_symbols = ('1', '2', '3', '+',
                          '4', '5', '6', '-',
                          '7', '8', '9', '.',
                          '0', '*', '/', '=')

        button_grid = GridLayout(cols=4, size_hint_y=2) 
        for symbol in button_symbols:
            button_grid.add_widget(Button(text=symbol))

        clear_button = Button(text='clear', size_hint_y=None,
                              height=100)

        root_widget.add_widget(output_label)
        root_widget.add_widget(button_grid)
        root_widget.add_widget(clear_button)

        return root_widget
项目:HeaTDV4A    作者:HeaTTheatR    | 项目源码 | 文件源码
def __init__(self, **kvargs):
        super(FileChooser, self).__init__(**kvargs)

        box = BoxLayout(orientation="vertical", spacing=10)
        filechooser = FileChooserListView()
        filechooser.bind(selection=self.select_callback)
        box.add_widget(filechooser)

        if self.filter == "folder":
            box.add_widget(SettingSpacer())
            box.add_widget(Button(text=self.text_button_select,
                                  size_hint=(1, .1),
                                  on_press=self.select_callback))
            filechooser.filters = [self.is_dir]
        elif self.filter == "files":
            filechooser.filters = [self.is_file]

        self.body = Popup(title=self.title, content=box, size_hint=self.size,
                          auto_dismiss=self.auto_dismiss,
                          background=self.background_image)
        self.body.bind(on_dismiss=self.dismiss_callback)
        self.body.open()
项目:HeaTDV4A    作者:HeaTTheatR    | 项目源码 | 文件源码
def __init__(self, **kvargs):
        super(KDialog, self).__init__(**kvargs)

        self.orientation = "vertical"
        self.param = None

        # ???? ??? ?????? ?????? "??-???-??????".
        self.box_buttons_select = BoxLayout(orientation="horizontal",
                                            size_hint_y=None, height=40)
        self.scroll = ScrollView()
        self.box_content = GridLayout(cols=2, size_hint_y=None)
        self.box_content.bind(minimum_height=self.box_content.setter("height"))
        self.body = Popup(title_align=self.title_align,
                          background=self.background_image,
                          on_dismiss=self.dismiss_callback)
        # ??? ???? ?????????.
        with self.box_content.canvas:
            Color(0.16, 0.16, 0.16)
            self.canvas_for_box_content = \
                Rectangle(pos=(5, 5), size=(self.box_content.width,
                                            self.box_content.height))
            self.box_content.bind(size=self._update_canvas_size,
                                  pos=self._update_canvas_size)

        self.scroll.add_widget(self.box_content)
项目:HeaTDV4A    作者:HeaTTheatR    | 项目源码 | 文件源码
def __init__(self, **kvargs):
        super(SelectColor, self).__init__(**kvargs)

        box = BoxLayout(orientation="vertical")
        select_color = ColorPicker(hex_color=self.default_color)
        button_select = Button(text=self.text_button_ok, size_hint=(1, .1))

        box.add_widget(select_color)
        box.add_widget(Widget(size_hint=(None, .02)))
        box.add_widget(SettingSpacer())
        box.add_widget(Widget(size_hint=(None, .02)))
        box.add_widget(button_select)

        self.body = Popup(title=self.title, content=box, size_hint=self.size,
                          background=self.background_image)
        self.body.bind(on_dismiss=self.dismiss_callback)

        button_select.bind(on_press=lambda color: self.select_callback(
            select_color.hex_color), on_release=lambda *args: self.body.dismiss())
        self.body.open()
项目:POS-System    作者:obernardovieira    | 项目源码 | 文件源码
def finishBuyList(self):
        #ask to confirm
        content = BoxLayout(orientation = 'vertical')
        content.add_widget(Label(text = 'Do you really want to finish?'))
        button_confirm = Button(text='Finish')
        button_confirm.bind(on_press=self.registerBuy)
        button_cancel = Button(text='Cancel')
        button_cancel.bind(on_press=self.popup.dismiss)
        options = BoxLayout()
        options.add_widget(button_confirm)
        options.add_widget(button_cancel)
        content.add_widget(options)

        #
        self.popup = Popup(
                    title           = 'Finish Buy List',
                    content         = content,
                    size_hint       = (None, None),
                    size            = (400, 100)
                )

        # open the popup
        self.popup.open()

    ###
项目:ninety_per_ten    作者:arruda    | 项目源码 | 文件源码
def _build_evaluation_box(self):
        evaluation_box = BoxLayout(orientation='horizontal')
        positive_button = Button(
            text="Positive",
            font_size=50,
            size_hint=(.5, .5),
            background_normal='',
            background_color=rgb_to_kivy(0, 102, 0, 1)
        )
        positive_button.bind(on_release=self.handle_positive_button)

        negative_button = Button(
            text="Negative",
            font_size=50,
            size_hint=(.5, .5),
            background_normal='',
            background_color=rgb_to_kivy(255, 0, 0, 1)
        )
        negative_button.bind(on_release=self.handle_negative_button)

        evaluation_box.add_widget(positive_button)
        evaluation_box.add_widget(negative_button)
        return evaluation_box
项目:ninety_per_ten    作者:arruda    | 项目源码 | 文件源码
def _build_detail_event_box(self, event):
        event_layout = BoxLayout(orientation='horizontal')
        label_color = rgb_to_kivy(0, 102, 0, 1) if event.evaluation else rgb_to_kivy(255, 0, 0, 1)
        # event_eval_text = 'Positive' if event.evaluation else 'Negative'
        # event_text = "{} [{}]".format(event.date.strftime("%d/%m/%y  %H:%M:%S"), event_eval_text)
        event_text = event.date.strftime("%d/%m/%y  %H:%M:%S")
        event_label = Label(text=event_text, font_size=70, color=label_color, size_hint=(1, 1))

        event_rm_button = Button(
            text="-",
            font_size=50,
            size_hint=(.15, 1),
            background_normal='',
            background_color=rgb_to_kivy(255, 0, 0, 1)
        )
        handle_rm_with_event = partial(self.handle_rm_event, event)
        event_rm_button.bind(on_release=handle_rm_with_event)

        event_layout.add_widget(event_label)
        event_layout.add_widget(event_rm_button)
        return event_layout
项目:cloud-clipboard    作者:krsoninikhil    | 项目源码 | 文件源码
def __init__(self, auth_token, **kwargs):
        super(CloudCBScreen, self).__init__(**kwargs)
        self.header = {'Authorization': "Basic %s" % auth_token}
        self.url = SERVER_URI + 'copy-paste/'
        self.old_text = Clipboard.paste()
        self.cloud_clip = TextInput(text="Fetching...")

        layout = BoxLayout(orientation='vertical')
        layout.add_widget(Label(text='Cloud Clipboard'))
        layout.add_widget(Label(text='Current text on clipboard:'))
        layout.add_widget(self.cloud_clip)
        layout.add_widget(Button(text='Refresh', on_press=self.download))
        layout.add_widget(Label(text='Earlier text on your clipboard:'))
        layout.add_widget(TextInput(text=self.old_text))
        layout.add_widget(Button(text='Update Cloud Clipboard with this text', on_press=self.upload))
        self.add_widget(layout)

        self.download()
项目:Mobile-TetriNET    作者:Smug28    | 项目源码 | 文件源码
def __init__(self, app, **kwargs):
        self.app = app
        self.bar_color = [.071, .729, .973, .9]
        self.bar_width = '3dp'
        self.scroll_timeout = 100
        img = Image('crop/dock_POT.png')
        img.texture.wrap = "repeat"
        self.texture = img.texture
        self.texture_size = self.texture.size
        self.sOverlay = app.sOverlay
        self.players = app.overlay
        super(Dock, self).__init__(**kwargs)
        self.bar_margin = self.texture_size[1]*0.1645
        self.do_scroll_y = False
        self.do_scroll_x = True
        self.layout = BoxLayout(size_hint_x=None, width=0)
        self.add_widget(self.layout)
项目:PyCon-Mobile-App    作者:pythonindia    | 项目源码 | 文件源码
def on_pre_enter(self):

        with open('eventsapp/data/jsonfiles/community.json') as data_file:
            data = json.load(data_file)

        data = data.get("0.0.1")[0]

        self.ids.logo.source = data['photo']
        self.ids.about.text = data['about']
        social_icons = self.ids.social_icons
        social_icons.clear_widgets()
        self.community_social = data['social']

        def chunks(data, SIZE=10):
            it = iter(data)
            for i in range(0, len(data), SIZE):
                yield {k:data[k] for k in islice(it, SIZE)}

        if self.community_social != []:
            for items in chunks(self.community_social, 3):
                bl = BoxLayout()
                self.add_social_icons(bl, items)
                social_icons.add_widget(bl)
项目:iotdm-pyclient    作者:peterchauyw    | 项目源码 | 文件源码
def build(self):
        # Resource tree creation
        root = resource.CoAPResource()

        well_known = resource.CoAPResource()
        root.putChild('.well-known', well_known)
        core = CoreResource(root)
        well_known.putChild('core', core)

        counter = MOTDResource(self, 0)
        root.putChild('motd', counter)

        endpoint = resource.Endpoint(root)
        reactor.listenUDP(coap.COAP_PORT, coap.Coap(endpoint))

        # Kivy screen initialization
        self.label = Label(text="")
        self.display_counter(0)
        self.messagebox = TextInput(size_hint_y=.1, multiline=False)
        self.messagebox.text = "Message of the day"
        self.layout = BoxLayout(orientation='vertical', padding=10)
        self.layout.add_widget(self.label)
        self.layout.add_widget(self.messagebox)
        return self.layout
项目:mobileinsight-mobile    作者:mobile-insight    | 项目源码 | 文件源码
def onGoTo(self):
        if self.loaded == 'Yes':
            popup = BoxLayout(
                orientation='vertical',
                size=self.size,
                pos=self.pos)
            self.goto_popup = Popup(title='Go To' +
                                    '          (1~' +
                                    str(len(self.data_view)) +
                                    ')', content=popup, size_hint=(0.9, 0.25), auto_dismiss=False)
            self.goto_textinput = TextInput()
            cancel = Button(text='Cancel', on_release=self.dismiss_goto_popup)
            ok = Button(text='Ok', on_release=self.goto_ok)
            buttons = BoxLayout(size_hint_y=None, height=self.height / 20)
            buttons.add_widget(cancel)
            buttons.add_widget(ok)
            popup.add_widget(self.goto_textinput)
            popup.add_widget(buttons)
            self.goto_popup.open()
项目:Easy    作者:HeaTTheatR    | 项目源码 | 文件源码
def __init__(self, **kvargs):
        super(KDialog, self).__init__(**kvargs)

        self.param = None
        self.rst = None
        self.input_dialog_double = None

        # ???? ??? ?????? 'Yes, No, Cancel'.
        self.box_buttons_select = \
            BoxLayout(size_hint_y=None, height=self.dp(40), spacing=5)
        self.scroll = self.ids.scroll
        self.box_root = self.ids.box_root
        self.box_content = self.ids.box_content
        self.box_content.bind(
            height=lambda *args: self._update_box_content_size(args)
        )
项目:Easy    作者:HeaTTheatR    | 项目源码 | 文件源码
def __init__(self, **kvargs):
        super(CDialog, self).__init__(**kvargs)

        box = BoxLayout(orientation='vertical')
        select_color = ColorPicker(hex_color=self.default_color)
        button_select = Button(
            text=self.text_button_ok, size_hint=(1, .1),
            background_normal=self.background_image_buttons[0],
            background_down=self.background_image_shadows[0]
        )

        box.add_widget(select_color)
        box.add_widget(Widget(size_hint=(None, .02)))
        box.add_widget(SettingSpacer())
        box.add_widget(Widget(size_hint=(None, .02)))
        box.add_widget(button_select)

        button_select.bind(
            on_press=lambda color: self.events_callback(select_color.hex_color),
            on_release=lambda *args: self.dismiss()
        )
        self.content = box
        self.open()
项目:Easy    作者:HeaTTheatR    | 项目源码 | 文件源码
def __init__(self, **kvargs):
        super(FDialog, self).__init__(**kvargs)

        box = BoxLayout(orientation='vertical', spacing=10)
        fdialog = FileChooserListView(path=self.path)
        fdialog.bind(selection=self.events_callback)
        box.add_widget(fdialog)

        if self.filter == 'folder':
            box.add_widget(SettingSpacer())
            box.add_widget(
                Button(text=self.text_button_ok, size_hint=(1, .1),
                       background_normal=self.background_image_buttons[0],
                       background_down=self.background_image_shadows[0],
                       on_press=self.events_callback)
            )
            fdialog.filters = [self.is_dir]
        elif self.filter == 'files':
            fdialog.filters = [self.is_file]

        self.content = box
        self.open()
项目:garden.xpopup    作者:kivy-garden    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        # preventing change content of the popup
        kwargs.pop('content', None)
        self._pnl_buttons = None
        super(XBase, self).__init__(**kwargs)

        layout = BoxLayout(orientation="vertical")
        layout.add_widget(self._get_body())
        self._pnl_buttons = BoxLayout(size_hint_y=None)
        layout.add_widget(self._pnl_buttons)
        self.add_widget(layout)

        # creating buttons panel
        self.property('buttons').dispatch(self)

        if self.auto_open:
            self.open()
项目:garden.xpopup    作者:kivy-garden    | 项目源码 | 文件源码
def _get_body(self):
        if self.dont_show_value is None:
            return self._message
        else:
            pnl = BoxLayout(orientation='vertical')
            pnl.add_widget(self._message)

            pnl_cbx = BoxLayout(
                size_hint_y=None, height=metrics.dp(35), spacing=5)
            cbx = CheckBox(
                active=self.dont_show_value, size_hint_x=None,
                width=metrics.dp(50))
            cbx.bind(active=self.setter('dont_show_value'))
            pnl_cbx.add_widget(cbx)
            pnl_cbx.add_widget(
                Factory.XLabel(text=self.dont_show_text, halign='left'))

            pnl.add_widget(pnl_cbx)
            return pnl
项目:kdialog    作者:HeaTTheatR    | 项目源码 | 文件源码
def __init__(self, **kvargs):
        super(CDialog, self).__init__(**kvargs)

        box = BoxLayout(orientation='vertical')
        select_color = ColorPicker(hex_color=self.default_color)
        button_select = Button(
            text=self.text_button_ok, size_hint=(1, .1),
            background_normal=self.background_image_buttons[0],
            background_down=self.background_image_shadows[0],
            background_color=choice(self.background_color_buttons)
        )

        box.add_widget(select_color)
        box.add_widget(Widget(size_hint=(None, .02)))
        box.add_widget(SettingSpacer())
        box.add_widget(Widget(size_hint=(None, .02)))
        box.add_widget(button_select)

        button_select.bind(
            on_press=lambda color: self.events_callback(select_color.hex_color),
            on_release=lambda *args: self.dismiss()
        )
        self.content = box
        self.open()
项目:KivMob    作者:MichaelStott    | 项目源码 | 文件源码
def desktop_warning(self):
        layout = BoxLayout(orientation='vertical')
        layout.add_widget(Label(text='KivMob will not display ads on ' +\
                          'nonmobile platforms. You must build an ' +\
                          'Android project to demo ads. (iOS not yet ' +\
                          'supported)',
                          size_hint_y=1,
                          text_size=(250,  None),
                          halign='left',
                          valign='middle'))
        button_layout = BoxLayout()
        button1=Button(text="Open Build Steps", size_hint=(0.8, 0.2))
        button1.bind(on_release = lambda x :
                     webbrowser.open("https://www.google.com"))
        button_layout.add_widget(button1)
        button2=Button(text="Close", size_hint=(0.8, 0.2))
        button2.bind(on_release = lambda x : popup.dismiss())
        button_layout.add_widget(button2)
        layout.add_widget(button_layout)
        popup = Popup(title='KivMob Demo Alert',
                      content=layout,
                      size_hint=(0.9, 0.9))
        popup.open()
项目:KivMob    作者:MichaelStott    | 项目源码 | 文件源码
def interstitial_warning(self):
        layout = BoxLayout(orientation='vertical')
        layout.add_widget(Label(text="Ad has not loaded. " +\
                                    "Wait a few seconds and then " +\
                                    "try again.",
                                    size_hint_y=1,
                                    text_size=(250,  None),
                                    halign='left',
                                    valign='middle'))
        button_layout = BoxLayout()
        close=Button(text="Close", size_hint=(0.8, 0.2))
        close.bind(on_release = lambda x : popup.dismiss())
        button_layout.add_widget(close)
        layout.add_widget(button_layout)
        popup = Popup(title='KivMob Demo Alert',
                      content=layout,
                      size_hint=(0.9, 0.9))
        popup.open()
项目:KivyCleanMasterDemo    作者:HeaTTheatR    | 项目源码 | 文件源码
def create_menu_buttons(self):
        """??????? ?????? ? ??????? ????."""

        name_path_buttons_menu = {
            "JUNK FILES": "Data/Images/clean_cache.png",
            "MEMORY BOOST": "Data/Images/clean_memory.png",
            "APP MANAGER": "Data/Images/clean_apk.png",
            "SECURITY & PRIVACY": "Data/Images/clean_privacy.png"}

        for name_button in name_path_buttons_menu.keys():
            item_box = BoxLayout(orientation="vertical")
            item_label = Label(text=name_button, color=[.1, .1, .1, 1])
            item_button = \
                ImageButton(source=name_path_buttons_menu[name_button],
                            id=name_button, on_press=self.events_callback)
            item_box.add_widget(item_button)
            item_box.add_widget(item_label)
            self.ids.body_buttons_menu.add_widget(item_box)
项目:Kivy_practice    作者:okajun35    | 项目源码 | 文件源码
def calculate(self):
        ''' "="???????????????  '''
        try:
            self.display.text = str(eval(self.display.text)) # ???????  ??eval("5 + 10")??15???
            self.clear_bool = True

            print('????')
        except:
            # ?????????'=’??????????????
            print('error?????')


#class Calculator2(BoxLayout):
#    def __init__(self, **kwargs):
#        super(Calculator2, self).__init__(**kwargs)
项目:kivy_soil    作者:Bakterija    | 项目源码 | 文件源码
def __init__(self, data=None, **kwargs):
        super(RecycleDataBox, self).__init__(**kwargs)
        self._topwidget = ShellWidget(place='top')
        self._botwidget = ShellWidget(place='bot')
        self.view = BoxLayout(size_hint_y=None, orientation='vertical')
        self.view.bind(minimum_size=self.view.setter('size'))
        self.height_cache = {}
        for widget in self._topwidget, self.view, self._botwidget:
            self.add_widget(widget)
项目:POS-System    作者:obernardovieira    | 项目源码 | 文件源码
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)'''

    ###
项目:ninety_per_ten    作者:arruda    | 项目源码 | 文件源码
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
项目:ninety_per_ten    作者:arruda    | 项目源码 | 文件源码
def _filter_layout(self):
        filter_box = BoxLayout(orientation='vertical', spacing=50)

        dropdown = DropDown()
        for filter_type in FILTERS.keys():
            filter_button = Button(
                text=filter_type,
                font_size=30,
                background_normal='',
                background_color=rgb_to_kivy(239, 93, 5, 1),
                size_hint_y=None,
                height=130
            )
            handle_filter_button_with_dropdown = partial(self.handle_filter_button, dropdown)
            filter_button.bind(on_release=handle_filter_button_with_dropdown)
            dropdown.add_widget(filter_button)

        filter_dropdown_btn = Button(
            text=ALL_FILTER,
            font_size=30,
            size_hint=(1, 1),
            background_normal='',
            background_color=rgb_to_kivy(239, 93, 5, 1)
        )
        filter_dropdown_btn.bind(on_release=dropdown.open)

        dropdown.bind(on_select=lambda instance, x: setattr(filter_dropdown_btn, 'text', x))
        filter_box.add_widget(filter_dropdown_btn)
        return filter_box
项目:ninety_per_ten    作者:arruda    | 项目源码 | 文件源码
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
项目:ninety_per_ten    作者:arruda    | 项目源码 | 文件源码
def _build_main_box(self):
        main_box = BoxLayout(orientation='vertical')
        main_box.add_widget(self._build_top_box())
        main_box.add_widget(self._build_botton_box())
        return main_box
项目:ninety_per_ten    作者:arruda    | 项目源码 | 文件源码
def _build_event_list(self):
        self.event_list_layout = BoxLayout(orientation='vertical', spacing=30)
        self.update_event_list()
        return self.event_list_layout
项目:MeetNet    作者:dimgold    | 项目源码 | 文件源码
def __init__(self,req):
        super(BoxLayout,self).__init__()
        self.request_user = req[0]
        self.request_group = req[1]
        self.friend_req.text = "The User '%s' Wants to join the group '%s'" %(self.request_user, self.request_group)
项目:autopen    作者:autopen    | 项目源码 | 文件源码
def build(self):
        #with open("tips.txt", "r") as stream:
        #    labeltext = stream.read()
        label = Label(text="[size=50]hi[/size]", markup=True)
        box = BoxLayout()
        marvell = Marvel()
        box.add_widget(marvell)
        box.add_widget(label)
        return box
项目:Mobile-TetriNET    作者:Smug28    | 项目源码 | 文件源码
def __init__(self, **kwargs):   # inicializace
        super(StatsScreen, self).__init__(**kwargs)
        self.root.insertStrings.append((self, "STR_STATS"))
        self.stats = BoxLayout(orientation='vertical', size_hint=(.77, .83), pos_hint={'center_x': .5, 'center_y': .49})
        self.title = BoxLayout(orientation='horizontal')
        self.title.add_widget(Label(font_name='font/Roboto-Bold.ttf', text=''))
        self.title.add_widget(Label(font_name='font/Roboto-Bold.ttf', text=''))
        self.title.add_widget(Label(font_name='font/Roboto-Bold.ttf', text=''))
        self.stats.add_widget(self.title)
        self.add_widget(self.stats)
        self.root.insertStrings.append((self.title.children[2], "STR_TYPE"))
        self.root.insertStrings.append((self.title.children[1], "STR_NAME"))
        self.root.insertStrings.append((self.title.children[0], "STR_SCORE"))
项目:Mobile-TetriNET    作者:Smug28    | 项目源码 | 文件源码
def on_pre_enter(self, *args):
        # P?ed vstupem na obrazovku na?te seznam oblíbených server?
        if len(self.layout.children) == 0:
            bookmarks = self.root.Cfg[-1]
            if len(bookmarks) == 0:
                self.layout.add_widget(Label(text=self.STR_NO_BOOKMARKS, font_name='font/Roboto-Regular.ttf', font_size='18dp', size_hint_y = None, text_size=(self.width*3, None)))
            else:
                head = BoxLayout(size_hint=(1,None), height=50)
                head.add_widget(Label(text=self.STR_SERVER, font_name='font/Roboto-Bold.ttf', size_hint=(None,1), font_size="20dp", width = self.width*1.9, text_size=(self.width*1.9, None)))
                head.add_widget(Label(text=self.STR_MOD, font_name='font/Roboto-Bold.ttf', size_hint=(1,1), font_size="15dp", width = self.width, text_size=(self.width, None)))
                head.add_widget(DelButton(opacity=0, size_hint=(None, 1)))
                self.layout.add_widget(head)
                for y, server in enumerate(bookmarks):
                    srvr = Bookmark(size_hint=(1,None), height = 50)
                    for i, cell in enumerate(server):
                        if i == 0:
                            lbl = Label(text="[ref={0}]{1}[/ref]".format(y,cell), markup=True, font_name='font/Roboto-Regular.ttf', size_hint=(None,1), font_size="20dp", text_size=(None, None))
                            lbl.bind(on_ref_press=self.connectBookmark)
                            srvr.add_widget(lbl)
                        elif i == 1:
                            pass
                        elif i == 2:
                            lbl = Label(text="[ref={0}]{1}[/ref]".format(y,cell), markup=True, font_name='font/Roboto-Regular.ttf', size_hint=(1,1), font_size="20dp")
                            lbl.bind(on_ref_press=self.connectBookmark)
                            srvr.add_widget(lbl)
                    btn = DelButton(OBJ=srvr, ID=y, background_normal="crop/delete.png", background_down="crop/delete.png",size_hint=(None, 1))
                    btn.bind(on_press=self.removeBookmark)
                    srvr.add_widget(btn)
                    self.layout.add_widget(srvr)
项目:Mobile-TetriNET    作者:Smug28    | 项目源码 | 文件源码
def _key_handler(self, instance, KEY, *args):   # Reakce na stisk systémové klávesy OS Android
        print "Key: {0}".format(KEY)
        if KEY == 1001:
            if self.sm.current not in ('MainMenuScreen', 'GameScreen'):
                if self.sm.current == "SettingsScreen":
                    self.sm.get_screen("SettingsScreen").dropdown.dismiss()
                self.sm.current_screen.prev()
            else:
                if self.sm.current == 'MainMenuScreen':
                    text = self.L.STR_POPUP_EXIT
                    title = self.L.STR_POPUP_EXIT_TITLE
                    yes_callback = self.popupStop
                else:
                    text = self.L.STR_POPUP_DISCONNECT
                    title = self.L.STR_POPUP_DISCONNECT_TITLE
                    yes_callback = self.popupDisconnect
                content = BoxLayout(orientation='vertical')
                content.add_widget(Label(text=text, font_name='font/Roboto-Regular.ttf', font_size='14dp'))
                buttons = GridLayout(cols=2, rows=1, spacing=10, size_hint=(1, .3))
                yes = Button(text=self.L.STR_YES)
                yes.bind(on_press=yes_callback)
                no = Button(text=self.L.STR_NO)
                buttons.add_widget(yes)
                buttons.add_widget(no)
                content.add_widget(buttons)
                self.popupExit = Popup(title=title, size_hint=(.7,.3), content=content, auto_dismiss=False)
                no.bind(on_press=self.popupExit.dismiss)
                self.popupExit.open()
        elif KEY == 1002:
            self.dispatch('on_pause')
        elif KEY == 1004:
            self.dispatch('on_pause')
项目:kivy-tutorials    作者:inclement    | 项目源码 | 文件源码
def build(self):
        layout = BoxLayout(orientation='vertical')
        b1 = Button(text='button 1')
        b2 = Button(text='button 2')

        layout.add_widget(b1)
        layout.add_widget(b2)

        return layout
项目:KivyMdDemo    作者:captainbupt    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(MyScreen, self).__init__(**kwargs)
        scrollView = ScrollView()
        self.add_widget(scrollView)

        boxLayout = BoxLayout(orientation='vertical', height=dp(1000), padding=dp(48))
        scrollView.add_widget(boxLayout)
        textField = SingleLineTextField(id='text_filed', size_hint=(0.8, None), height=dp(48))
        textField.hint_text='This is a pretty text filed'
        boxLayout.add_widget(textField)
        buttonContainer = BoxLayout(orientation='horizontal', height=dp(48))
        flatButton = MDFlatButton(text='FlatButton')
        # size is not working somehow
        # flatButton.size = (3*dp(48), dp(48))
        buttonContainer.add_widget(flatButton)
        raiseButton = MDRaisedButton(text='RaiseButton')
        # raiseButton.size = (3*dp(48), dp(48))
        buttonContainer.add_widget(raiseButton)
        boxLayout.add_widget(buttonContainer)

        switchContainer = BoxLayout(orientation='horizontal')
        checkbox1 = MDCheckbox(group='test')
        # checkbox1.size=(dp(48), dp(48))
        switchContainer.add_widget(checkbox1)
        checkbox2 = MDCheckbox(group='test')
        # checkbox2.size=(dp(48), dp(48))
        switchContainer.add_widget(checkbox2)
        boxLayout.add_widget(switchContainer)
项目:Blogs-Posts-Tutorials    作者:kiok46    | 项目源码 | 文件源码
def build(self):
            from kivy.core.window import Window
            Window.size = (540, 720)
            # self.theme_cls.theme_style = 'Dark'

            return Builder.load_string("""
#:import Toolbar kivymd.toolbar.Toolbar
BoxLayout:
    orientation:'vertical'
    Toolbar:
        id: toolbar
        title: 'Page title'
        background_color: app.theme_cls.primary_color
        left_action_items: [['menu', lambda x: '']]
        right_action_items: [['search', lambda x: ''],['more-vert',lambda x:'']]
    MDTabbedPanel:
        id: tab_mgr
        tab_display_mode:'icons'

        MDTab:
            name: 'music' 
            text: "Music" # Why are these not set!!!
            icon: "playlist-audio"
            MDLabel:
                font_style: 'Body1'
                theme_text_color: 'Primary'
                text: "Here is my music list :)"
                halign: 'center'
        MDTab:
            name: 'movies'
            text: 'Movies'
            icon: "movie"

            MDLabel:
                font_style: 'Body1'
                theme_text_color: 'Primary'
                text: "Show movies here :)"
                halign: 'center'


""")
项目:iotdm-pyclient    作者:peterchauyw    | 项目源码 | 文件源码
def open_message_popup(self):
        if self.response is not None:
            content = BoxLayout(orientation='vertical', spacing=5)
            content.add_widget(PopupButton(text='Add bookmark',on_release=self.add_bookmark))
            if self.response.opt.content_format is coap.media_types_rev['application/link-format']:
                content.add_widget(PopupButton(text='Process link format',on_release=self.process_link_format))
            self.controller.popup.content = content
            self.controller.popup.open()
项目:iotdm-pyclient    作者:peterchauyw    | 项目源码 | 文件源码
def open_node_label_popup(self, link_node, value):
        if value=='node' and self.level == 1:
            content = BoxLayout(orientation='vertical', spacing=5)
            content.add_widget(PopupButton(text='Repeat discovery',on_release=self.open_link))
            content.add_widget(PopupButton(text='Remove discovery result',on_release=self.remove_node))
            self.controller.popup.content = content
            self.controller.popup.open()
        elif value=='uri':
            content = BoxLayout(orientation='vertical', spacing=5)
            content.add_widget(PopupButton(text='Open bookmark',on_release=self.open_link))
            content.add_widget(PopupButton(text='Remove bookmark',on_release=self.remove_bookmark))
            self.controller.popup.content = content
            self.controller.popup.open()
项目:mobileinsight-mobile    作者:mobile-insight    | 项目源码 | 文件源码
def onSearch(self):
        popup = BoxLayout(orientation='vertical', size=self.size, pos=self.pos)
        self.search_popup = Popup(
            title='Search', content=popup, size_hint=(
                0.9, 0.25), auto_dismiss=False)
        self.search_textinput = TextInput()
        cancel = Button(text='Cancel', on_release=self.dismiss_search_popup)
        ok = Button(text='Ok', on_release=self.search_ok)
        buttons = BoxLayout(size_hint_y=None, height=self.height / 20)
        buttons.add_widget(cancel)
        buttons.add_widget(ok)
        popup.add_widget(self.search_textinput)
        popup.add_widget(buttons)
        self.search_popup.open()
项目:garden.touchgraph    作者:kivy-garden    | 项目源码 | 文件源码
def build(self):
            box = BoxLayout()
            graph = DemoGraph(points=[0, .2, 1, 0.25, 2, .4, 5, .5, 10, .6, 30, .5],
                              font_size=30,
                              line_width=5,
                              x_labels=['A', 'B', 'C', 'D'],
                              x_ticks=[0, 10, 20, 30],
                              y_ticks=[.1, .2, .5, .9],
                              max_y=1)
            box.add_widget(graph)
            return box
项目:Easy    作者:HeaTTheatR    | 项目源码 | 文件源码
def show_banners(self, interval):
        if self.screen.ids.screen_manager.current == '':
            name_banner = self.choice(self.banner_list)

            box_banner = BoxLayout()
            new_banner = ImageButton(
                id=name_banner.split('.')[0],
                source='Data/Images/banners/{}'.format(name_banner),
                on_release=self.press_banner
            )
            box_banner.add_widget(new_banner)

            name_screen = name_banner
            banner = self.Screen(name=name_screen)
            banner.add_widget(box_banner)
            self.screen.ids.banner_manager.add_widget(banner)
            effect = self.choice(self.effects_transition)
            direction = self.choice(self.directions)
            if effect != self.SwapTransition:
                self.screen.ids.banner_manager.transition = effect(
                    direction=direction
                )
            else:
                self.screen.ids.banner_manager.transition = effect()
            self.screen.ids.banner_manager.current = name_screen
            self.screen.ids.banner_manager.screens.pop()
项目:Easy    作者:HeaTTheatR    | 项目源码 | 文件源码
def __init__(self, **kvargs):
        super(PDialog, self).__init__(**kvargs)

        self.box = BoxLayout(orientation='vertical')
        self.label_one = Label(text='', size_hint=(1, .1), markup=True)
        self.label_two = Label(text='', size_hint=(1, .1), markup=True)
        self.progress_load = Progress()
        self.button_cancel = Button(
            text='Cancel', on_press=self.events_callback, size_hint=(1, .1),
            background_normal=self.background_image_buttons[0],
            background_down=self.background_image_shadows[0]
        )

        self.label_one.bind(size=lambda *args: self._update_text_size(args))
        self.label_two.bind(size=lambda *args: self._update_text_size(args))

        self.box.add_widget(self.label_one)
        self.box.add_widget(self.label_two)
        self.box.add_widget(Widget(size_hint=(None, .02)))
        self.box.add_widget(SettingSpacer())
        self.box.add_widget(Widget(size_hint=(None, .02)))
        self.box.add_widget(self.progress_load)
        self.box.add_widget(Widget(size_hint=(None, .3)))
        self.box.add_widget(SettingSpacer())
        self.box.add_widget(Widget(size_hint=(None, .02)))
        self.box.add_widget(self.button_cancel)

        self.progress_load.min = 0
        self.progress_load.max = 100
        self.progress_load.bar_value = 0
        self.progress_load.height_widget = self.dp(self.progress_line_height)
        self.progress_load.color = self.progress_line_color
        self.progress_load.border_color = self.progress_border_color
项目:garden.xpopup    作者:kivy-garden    | 项目源码 | 文件源码
def _get_body(self):
        layout = BoxLayout(orientation='vertical')
        layout.add_widget(super(XProgress, self)._get_body())
        layout.add_widget(self._progress)
        return layout
项目:garden.xpopup    作者:kivy-garden    | 项目源码 | 文件源码
def _get_body(self):
        from kivy.lang import Builder
        import textwrap
        self.browser = Builder.load_string(textwrap.dedent('''\
        FileChooser:
            FileChooserIconLayout
            FileChooserListLayout
        '''))

        self.browser.path = self.path
        self.browser.multiselect = self.multiselect
        self.browser.dirselect = self.dirselect
        self.browser.filters = self.filters
        self.browser.bind(path=self.setter('path'),
                          selection=self.setter('selection'))
        self.bind(view_mode=self.browser.setter('view_mode'),
                  multiselect=self.browser.setter('multiselect'),
                  dirselect=self.browser.setter('dirselect'),
                  filters=self.browser.setter('filters'))

        lbl_path = Factory.XLabel(
            text=self.browser.path, valign='top', halign='left',
            size_hint_y=None, height=metrics.dp(25))
        self.browser.bind(path=lbl_path.setter('text'))

        layout = BoxLayout(orientation='vertical')
        layout.add_widget(self._ctrls_init())
        layout.add_widget(lbl_path)
        layout.add_widget(self.browser)
        return layout
项目:garden.xpopup    作者:kivy-garden    | 项目源码 | 文件源码
def _ctrls_init(self):
        pnl_controls = BoxLayout(size_hint_y=None, height=metrics.dp(25))
        pnl_controls.add_widget(Factory.XButton(
            text=_('Icons'), id=self.CTRL_VIEW_ICON,
            on_release=self._ctrls_click))
        pnl_controls.add_widget(Factory.XButton(
            text=_('List'), id=self.CTRL_VIEW_LIST,
            on_release=self._ctrls_click))
        pnl_controls.add_widget(Factory.XButton(
            text=_('New folder'), id=self.CTRL_NEW_FOLDER,
            on_release=self._ctrls_click))
        return pnl_controls
项目:garden.xpopup    作者:kivy-garden    | 项目源码 | 文件源码
def _get_form(self):
        layout = BoxLayout(orientation='vertical', spacing=5)
        text_input = TextInput(id='text', multiline=False, text=self.text,
                               on_text_validate=self._on_text_validate,
                               # DON`T UNCOMMENT OR FOUND AND FIX THE ISSUE
                               # if `focus` set to `True` - TextInput will be
                               # inactive to edit
                               # focus=True,
                               size_hint_y=None, height=metrics.dp(33))
        layout.add_widget(Widget())
        layout.add_widget(text_input)
        layout.add_widget(Widget())
        return layout
项目:garden.xpopup    作者:kivy-garden    | 项目源码 | 文件源码
def _get_form(self):
        layout = BoxLayout(orientation='vertical', spacing=5)
        layout.add_widget(Widget())

        pnl = BoxLayout(size_hint_y=None, height=metrics.dp(28), spacing=5)
        pnl.add_widget(
            Factory.XLabel(text=_('Login:'), halign='right',
                           size_hint_x=None, width=metrics.dp(80)))
        pnl.add_widget(TextInput(id='login', multiline=False,
                                 font_size=metrics.sp(14), text=self.login))
        layout.add_widget(pnl)

        pnl = BoxLayout(size_hint_y=None, height=metrics.dp(28), spacing=5)
        pnl.add_widget(
            Factory.XLabel(text=_('Password:'), halign='right',
                           size_hint_x=None, width=metrics.dp(80)))
        pnl.add_widget(TextInput(id='password', multiline=False, font_size=14,
                                 password=True, text=self.password))
        layout.add_widget(pnl)

        if self.autologin is not None:
            pnl = BoxLayout(size_hint_y=None, height=metrics.dp(28), spacing=5)
            pnl.add_widget(CheckBox(
                id='autologin', size_hint_x=None, width=metrics.dp(80),
                active=self.autologin))
            pnl.add_widget(
                Factory.XLabel(text=_('Login automatically'), halign='left'))
            layout.add_widget(pnl)

        layout.add_widget(Widget())
        return layout
项目:SuperOcto    作者:mcecchi    | 项目源码 | 文件源码
def build(self):
        f = FloatLayout()
        s = Scatter()
        l = Label(text='Hello!', font_size=150)
        b = BoxLayout(orientation='vertical')
        t = TextInput(font_size=150)

        f.add_widget(s)
        s.add_widget(l)

        b.add_widget(f)
        b.add_widget(t)

        return b
项目:SuperOcto    作者:mcecchi    | 项目源码 | 文件源码
def _generate_layout(self, l_text, btn_text, f):
        """
        Layouts are similar in fashion: Text and Call to Action button
        creates layout with text and button and  binds f to button
        """
        layout = BoxLayout(orientation='vertical')
        btn = Button(text=btn_text, font_size=30)
        l = Label(text=l_text, font_size=30)
        btn.bind(on_press=f)
        layout.add_widget(l)
        layout.add_widget(btn)
        return layout