Python kivy.core.window.Window 模块,add_widget() 实例源码

我们从Python开源项目中,提取了以下28个代码示例,用于说明如何使用kivy.core.window.Window.add_widget()

项目:pydelhi_mobile    作者:pydelhi    | 项目源码 | 文件源码
def add_widget(self, widget):
        if len(self.children) == 0:
            super(NavigationDrawer, self).add_widget(widget)
            self._side_panel = widget
        elif len(self.children) == 1:
            super(NavigationDrawer, self).add_widget(widget)
            self._main_panel = widget
        elif len(self.children) == 2:
            super(NavigationDrawer, self).add_widget(widget)
            self._join_image = widget
        elif self.side_panel is None:
            self._side_panel.add_widget(widget)
            self.side_panel = widget
        elif self.main_panel is None:
            self._main_panel.add_widget(widget)
            self.main_panel = widget
        else:
            raise NavigationDrawerException(
                'Can\'t add more than two widgets'
                'directly to NavigationDrawer')
项目:PyCon-Mobile-App    作者:pythonindia    | 项目源码 | 文件源码
def add_widget(self, widget):
        if len(self.children) == 0:
            super(NavigationDrawer, self).add_widget(widget)
            self._side_panel = widget
        elif len(self.children) == 1:
            super(NavigationDrawer, self).add_widget(widget)
            self._main_panel = widget
        elif len(self.children) == 2:
            super(NavigationDrawer, self).add_widget(widget)
            self._join_image = widget
        elif self.side_panel is None:
            self._side_panel.add_widget(widget)
            self.side_panel = widget
        elif self.main_panel is None:
            self._main_panel.add_widget(widget)
            self.main_panel = widget
        else:
            raise NavigationDrawerException(
                'Can\'t add more than two widgets'
                'directly to NavigationDrawer')
项目:Easy    作者:HeaTTheatR    | 项目源码 | 文件源码
def add_widget(self, widget):
        if len(self.children) == 0:
            super(NavigationDrawer, self).add_widget(widget)
            self._side_panel = widget
        elif len(self.children) == 1:
            super(NavigationDrawer, self).add_widget(widget)
            self._main_panel = widget
        elif len(self.children) == 2:
            super(NavigationDrawer, self).add_widget(widget)
            self._join_image = widget
        elif self.side_panel is None:
            self._side_panel.add_widget(widget)
            self.side_panel = widget
        elif self.main_panel is None:
            self._main_panel.add_widget(widget)
            self.main_panel = widget
        else:
            raise NavigationDrawerException(
                'Can\'t add more than two widgets'
                'directly to NavigationDrawer')
项目:kivy_soil    作者:Bakterija    | 项目源码 | 文件源码
def _update_quickfind_label(self, _, value):
        qlabel = self._quickfind_label
        if value:
            if qlabel:
                qlabel.text = value
            else:
                self._quickfind_label = CompatTextInput(
                    text=value, size_hint=(None, None), pos=self.pos,
                    font_size=self.quickfind_font_size,
                    size=(self.width, int(self.quickfind_font_size * 2.3)))
                Window.add_widget(self._quickfind_label)
        else:
            if qlabel:
                Window.remove_widget(qlabel)
                self._quickfind_label = None
项目:kivy_soil    作者:Bakterija    | 项目源码 | 文件源码
def init_template_widgets(self, *args):
        Logger.info('TemplateApp: initialising template widgets')
        self.load_kv('kivy_soil/template_app/themes_layouts/term_and_toast.kv')
        self.info_widget = InfoWidget()
        self.term_widget = TerminalWidget()
        for data in logs.LoggerHistoryProper.data:
            self.term_widget.add_data(data['text'], data['level'])
        logs.LoggerHistoryProper.bind(
            on_add_data=lambda obj, data: self.term_widget.add_data(
                data['text'], data['level']))

        Window.add_widget(self.term_widget)
        Window.add_widget(self.info_widget)
        self.init_keybinds()
项目:kivy_soil    作者:Bakterija    | 项目源码 | 文件源码
def open(self, *largs):
        Window.add_widget(self)
        # Clock.schedule_once(lambda x: self.display_menu(largs[0]), -1)
        self.display_menu(largs[0])
项目:pydelhi_mobile    作者:pydelhi    | 项目源码 | 文件源码
def set_side_panel(self, widget):
        '''Removes any existing side panel widgets, and replaces them with the
        argument `widget`.
        '''
        # Clear existing side panel entries
        if len(self._side_panel.children) > 0:
            for child in self._side_panel.children:
                self._side_panel.remove(child)
        # Set new side panel
        self._side_panel.add_widget(widget)
        self.side_panel = widget
项目:pydelhi_mobile    作者:pydelhi    | 项目源码 | 文件源码
def set_main_panel(self, widget):
        '''Removes any existing main panel widgets, and replaces them with the
        argument `widget`.
        '''
        # Clear existing side panel entries
        if len(self._main_panel.children) > 0:
            for child in self._main_panel.children:
                self._main_panel.remove(child)
        # Set new side panel
        self._main_panel.add_widget(widget)
        self.main_panel = widget
项目:PyCon-Mobile-App    作者:pythonindia    | 项目源码 | 文件源码
def set_side_panel(self, widget):
        '''Removes any existing side panel widgets, and replaces them with the
        argument `widget`.
        '''
        # Clear existing side panel entries
        if len(self._side_panel.children) > 0:
            for child in self._side_panel.children:
                self._side_panel.remove(child)
        # Set new side panel
        self._side_panel.add_widget(widget)
        self.side_panel = widget
项目:PyCon-Mobile-App    作者:pythonindia    | 项目源码 | 文件源码
def set_main_panel(self, widget):
        '''Removes any existing main panel widgets, and replaces them with the
        argument `widget`.
        '''
        # Clear existing side panel entries
        if len(self._main_panel.children) > 0:
            for child in self._main_panel.children:
                self._main_panel.remove(child)
        # Set new side panel
        self._main_panel.add_widget(widget)
        self.main_panel = widget
项目:Blogs-Posts-Tutorials    作者:kiok46    | 项目源码 | 文件源码
def begin(self):
        if self.button_text == '':
            self.remove_widget(self.ids['_button'])
        else:
            self.ids['_spacer'].width = dp(16) if \
                DEVICE_TYPE == "mobile" else dp(40)
            self.padding_right = dp(16)
        Window.add_widget(self)
        anim = Animation(y=0, duration=.3, t='out_quad')
        anim.start(self)
        Clock.schedule_once(lambda dt: self.die(), self.duration)
项目:Blogs-Posts-Tutorials    作者:kiok46    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(SlidingPanel, self).__init__(**kwargs)
        self.shadow = PanelShadow()
        Clock.schedule_once(lambda x: Window.add_widget(self.shadow,89), 0)
        Clock.schedule_once(lambda x: Window.add_widget(self,90), 0)
项目:Blogs-Posts-Tutorials    作者:kiok46    | 项目源码 | 文件源码
def open(self, *largs):
        Window.add_widget(self)
        Clock.schedule_once(lambda x: self.display_menu(largs[0]), -1)
项目:mobileinsight-mobile    作者:mobile-insight    | 项目源码 | 文件源码
def begin(self):
        if self.button_text == '':
            self.remove_widget(self.ids['_button'])
        else:
            self.ids['_spacer'].width = dp(16) if DEVICE_TYPE == "mobile" else dp(40)
            self.padding_right = dp(16)
        Window.add_widget(self)
        anim = Animation(y=0, duration=.3, t='out_quad')
        anim.start(self)
        Clock.schedule_once(lambda dt: self.die(), self.duration)
项目:mobileinsight-mobile    作者:mobile-insight    | 项目源码 | 文件源码
def open(self, *largs):
        Window.add_widget(self)
        Clock.schedule_once(lambda x: self.display_menu(largs[0]), -1)
项目:Easy    作者:HeaTTheatR    | 项目源码 | 文件源码
def set_side_panel(self, widget):
        '''Removes any existing side panel widgets, and replaces them with the
        argument `widget`.
        '''
        # Clear existing side panel entries
        if len(self._side_panel.children) > 0:
            for child in self._side_panel.children:
                self._side_panel.remove(child)
        # Set new side panel
        self._side_panel.add_widget(widget)
        self.side_panel = widget
项目:Easy    作者:HeaTTheatR    | 项目源码 | 文件源码
def set_main_panel(self, widget):
        '''Removes any existing main panel widgets, and replaces them with the
        argument `widget`.
        '''
        # Clear existing side panel entries
        if len(self._main_panel.children) > 0:
            for child in self._main_panel.children:
                self._main_panel.remove(child)
        # Set new side panel
        self._main_panel.add_widget(widget)
        self.main_panel = widget
项目:kivy_gosh    作者:mcroni    | 项目源码 | 文件源码
def begin(self):
        if self.button_text == '':
            self.remove_widget(self.ids['_button'])
        else:
            self.ids['_spacer'].width = dp(16) if \
                DEVICE_TYPE == "mobile" else dp(40)
            self.padding_right = dp(16)
        Window.add_widget(self)
        anim = Animation(y=0, duration=.3, t='out_quad')
        anim.start(self)
        Clock.schedule_once(lambda dt: self.die(), self.duration)
项目:kivy_gosh    作者:mcroni    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(SlidingPanel, self).__init__(**kwargs)
        self.shadow = PanelShadow()
        Clock.schedule_once(lambda x: Window.add_widget(self.shadow,89), 0)
        Clock.schedule_once(lambda x: Window.add_widget(self,90), 0)
项目:kivy_gosh    作者:mcroni    | 项目源码 | 文件源码
def open(self, *largs):
        Window.add_widget(self)
        Clock.schedule_once(lambda x: self.display_menu(largs[0]), -1)
项目:KivyMD    作者:cruor99    | 项目源码 | 文件源码
def begin(self):
        if self.button_text == '':
            self.remove_widget(self.ids['_button'])
        else:
            self.ids['_spacer'].width = dp(16) if \
                DEVICE_TYPE == "mobile" else dp(40)
            self.padding_right = dp(16)
        Window.add_widget(self)
        anim = Animation(y=0, duration=.3, t='out_quad')
        anim.start(self)
        Clock.schedule_once(lambda dt: self.die(), self.duration)
项目:KivyMD    作者:cruor99    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(SlidingPanel, self).__init__(**kwargs)
        self.shadow = PanelShadow()
        Clock.schedule_once(lambda x: Window.add_widget(self.shadow, 89), 0)
        Clock.schedule_once(lambda x: Window.add_widget(self, 90), 0)
项目:KivyMD    作者:cruor99    | 项目源码 | 文件源码
def open(self, *largs):
        Window.add_widget(self)
        Clock.schedule_once(lambda x: self.display_menu(largs[0]), -1)
项目:mmplayer    作者:Bakterija    | 项目源码 | 文件源码
def _update_quickfind_label(self, _, value):
        qlabel = self._quickfind_label
        if value:
            if qlabel:
                qlabel.text = value
            else:
                self._quickfind_label = CompatTextInput(
                    text=value, size_hint=(None, None), pos=self.pos,
                    font_size=self.quickfind_font_size,
                    size=(self.width, int(self.quickfind_font_size * 2.3)))
                Window.add_widget(self._quickfind_label)
        else:
            if qlabel:
                Window.remove_widget(qlabel)
                self._quickfind_label = None
项目:mmplayer    作者:Bakterija    | 项目源码 | 文件源码
def init_template_widgets(self, *args):
        Logger.info('TemplateApp: initialising template widgets')
        self.load_kv('kivy_soil/template_app/themes_layouts/term_and_toast.kv')
        self.info_widget = InfoWidget()
        self.term_widget = TerminalWidget()
        for data in logs.LoggerHistoryProper.data:
            self.term_widget.add_data(data['text'], data['level'])
        logs.LoggerHistoryProper.bind(
            on_add_data=lambda obj, data: self.term_widget.add_data(
                data['text'], data['level']))

        Window.add_widget(self.term_widget)
        Window.add_widget(self.info_widget)
        self.init_keybinds()
项目:mmplayer    作者:Bakterija    | 项目源码 | 文件源码
def open(self, *largs):
        Window.add_widget(self)
        # Clock.schedule_once(lambda x: self.display_menu(largs[0]), -1)
        self.display_menu(largs[0])
项目:mmplayer    作者:Bakterija    | 项目源码 | 文件源码
def open(self, *largs):
        Window.add_widget(self)
        # Clock.schedule_once(lambda x: self.display_menu(largs[0]), -1)
        self.display_menu(largs[0])
项目:VKBot    作者:Fogapod    | 项目源码 | 文件源码
def show(self, length_long, *largs):
        duration = 5000 if length_long else 1000
        rampdown = duration * 0.1
        if rampdown > 500:
            rampdown = 500
        if rampdown < 100:
            rampdown = 100
        self._rampdown = rampdown
        self._duration = duration - rampdown
        Window.add_widget(self)
        Clock.schedule_interval(self._in_out, 1/60.0)