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

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

项目:RKSV    作者:ztp-at    | 项目源码 | 文件源码
def build(self):
        Window.bind(keyboard_height=self.updateHeight)
        if platform == 'android':
            return MainWidget()

        # the dreaded splash screen code
        from kivy.uix.screenmanager import NoTransition, ScreenManager, Screen
        from kivy.uix.image import Image

        sm = ScreenManager(transition=NoTransition())

        splashScr = Screen(name='SplashScreen')
        splashScr.add_widget(Image(source='misc/splash-desktop.png'))
        sm.add_widget(splashScr)

        mainScr = Screen(name='MainScreen')
        mainScr.add_widget(MainWidget())
        sm.add_widget(mainScr)

        def switchToMainScr(instance):
            sm.current = 'MainScreen'

        Clock.schedule_once(switchToMainScr, 3)

        return sm
项目:PyWallet    作者:AndreMiras    | 项目源码 | 文件源码
def create_item(self, account):
        """
        Creates an account list item from given account.
        """
        address = "0x" + account.address.encode("hex")
        # gets the alias if exists
        try:
            text = Controller.get_address_alias(address)
        except KeyError:
            text = address
        list_item = OneLineListItem(text=text)
        # makes sure the address doesn't overlap on small screen
        list_item.ids._lbl_primary.shorten = True
        list_item.account = account
        list_item.bind(on_release=lambda x: self.on_release(x))
        return list_item
项目:PyWallet    作者:AndreMiras    | 项目源码 | 文件源码
def set_font_and_shorten(self):
        """
        Makes the font slightly smaller on mobile
        by using "Body1" rather than "Button" style.
        Also shorten content size using ellipsis.
        """
        content = self.ids.content
        content.font_style = 'Body1'
        content.shorten = True

        def on_parent_size(instance, size):
            # see BaseRectangularButton.width definition
            button_margin = dp(32)
            parent_width = instance.width
            # TODO: the new size should be a min() of
            # parent_width and actual content size
            content.width = parent_width - button_margin
        self.parent.bind(size=on_parent_size)
        # call it once manually, refs:
        # https://github.com/AndreMiras/PyWallet/issues/74
        on_parent_size(self.parent, None)
项目:displayminion    作者:cedarsuite    | 项目源码 | 文件源码
def __init__(self, client, **kwargs):
        self.client = client
        self.disp_size = [0, 0]
        self.child_size = Window.size

        self.canvas = RenderContext(use_parent_projection = True)
        with self.canvas:
            self.fbo = Fbo(size = Window.size, use_parent_projection = True)

        with self.fbo:
            ClearColor(0, 0, 0, 0)
            ClearBuffers()

        super(DisplaySource, self).__init__(**kwargs)

        self.texture = self.fbo.texture

        if self.client.config.get('outputs', 'shmsink') == 'yes':
            from .GStreamerOutput import GStreamerOutput
            self.shmsinkoutput = GStreamerOutput(self.texture)
        else:
            self.shmsinkoutput = False

        Window.bind(on_resize = self.resize)
项目:garden.resizable_behavior    作者:kivy-garden    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(ResizeCursor, self).__init__(**kwargs)
        self.size_hint = (None, None)
        self.pos_hint = (None, None)
        self.source = ''
        self.rect = Rectangle(pos=(-9998,-9998), size=(1, 1))
        self.size = (dp(22), dp(22))
        self.pos = [-9998, -9998]

        # Makes an instruction group with a rectangle and
        # loads an image inside it
        # Binds its properties to mouse positional changes and events triggered
        instr = InstructionGroup()
        instr.add(self.rect)
        self.canvas.after.add(instr)
        self.bind(pos=lambda obj, val: setattr(self.rect, 'pos', val))
        self.bind(source=lambda obj, val: setattr(self.rect, 'source', val))
        self.bind(hidden=lambda obj, val: self.on_mouse_move(Window.mouse_pos))
        Window.bind(mouse_pos=lambda obj, val: self.on_mouse_move(val))
项目:mmplayer    作者:Bakterija    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(ResizableCursor, self).__init__(**kwargs)
        self.size_hint = (None, None)
        self.pos_hint = (None, None)
        self.source = ''
        self.rect = Rectangle(pos=(-9998,-9998), size=(1, 1))
        self.size = (dp(22), dp(22))
        self.pos = [-9998, -9998]

        # Makes an instruction group with a rectangle and
        # loads an image inside it
        # Binds its properties to mouse positional changes and events triggered
        instr = InstructionGroup()
        instr.add(self.rect)
        self.canvas.after.add(instr)
        self.bind(pos=lambda obj, val: setattr(self.rect, 'pos', val))
        self.bind(source=lambda obj, val: setattr(self.rect, 'source', val))
        self.bind(hidden=lambda obj, val: self.on_mouse_move(Window.mouse_pos))
        Window.bind(mouse_pos=lambda obj, val: self.on_mouse_move(val))
项目:PyWallet    作者:AndreMiras    | 项目源码 | 文件源码
def setup(self):
        """
        Binds Controller.current_account property.
        """
        self.controller = App.get_running_app().controller
        self.controller.bind(
            current_account=lambda _, value: self.on_current_account(value))
项目:PyWallet    作者:AndreMiras    | 项目源码 | 文件源码
def setup(self):
        """
        Binds Controller current_account and on_alias_updated.
        """
        self.controller = App.get_running_app().controller
        self.controller.bind(current_account=self.setter('current_account'))
        self.controller.bind(on_alias_updated=self.on_alias_updated)
        # triggers the update
        self.current_account = self.controller.current_account
项目:PyWallet    作者:AndreMiras    | 项目源码 | 文件源码
def setup(self):
        """
        Binds Controller.current_account property.
        """
        self.controller = App.get_running_app().controller
        self.controller.bind(current_account=self.setter('current_account'))
        # triggers the update
        self.current_account = self.controller.current_account
        self.controller.bind(accounts_history=self.update_history_list)
项目:PyWallet    作者:AndreMiras    | 项目源码 | 文件源码
def setup(self):
        """
        Binds Controller current_account and on_alias_updated.
        """
        self.controller = App.get_running_app().controller
        self.controller.bind(current_account=self.setter('current_account'))
        self.controller.bind(on_alias_updated=self.on_alias_updated)
        # triggers the update
        self.current_account = self.controller.current_account
项目:PyWallet    作者:AndreMiras    | 项目源码 | 文件源码
def setup(self):
        """
        Binds Controller.current_account property.
        """
        self.controller = App.get_running_app().controller
        self.pywalib = self.controller.pywalib
        self.controller.bind(current_account=self.setter('current_account'))
        # triggers the update
        self.current_account = self.controller.current_account
项目:PyWallet    作者:AndreMiras    | 项目源码 | 文件源码
def bind_on_symbols(self):
        """
        Since the camera doesn't seem to stop properly, we always bind/unbind
        on_pre_enter/on_pre_leave.
        """
        self.zbarcam.bind(symbols=self.on_symbols)
项目:PyWallet    作者:AndreMiras    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(Controller, self).__init__(**kwargs)
        keystore_path = Controller.get_keystore_path()
        self.pywalib = PyWalib(keystore_path)
        self.screen_history = []
        self.register_event_type('on_alias_updated')
        Clock.schedule_once(lambda dt: self.load_landing_page())
        Window.bind(on_keyboard=self.on_keyboard)
项目:PyWallet    作者:AndreMiras    | 项目源码 | 文件源码
def bind_current_account_balance(self):
        """
        Binds the accounts_balance to the Toolbar title.
        """
        self.bind(accounts_balance=self.update_toolbar_title_balance)
项目:HeaTDV4A    作者:HeaTTheatR    | 项目源码 | 文件源码
def __init__(self, **kvargs):
        super(Program, self).__init__(**kvargs)
        Window.bind(on_keyboard=self.events_program)

        # ??? ??????? ????????? ? programclass.
        self.FadeTransition = FadeTransition
        self.Screen = Screen
        self.Clock = Clock
        # ----------------------------------
        self.parsing_xml = parsing_xml
        self.get_page = get_page
        self.set_cookie = set_cookie
        self.Manifest = Manifest
        self.core = core
        # ----------------------------------
        self.sendmail = sendmail
        self.setattachtoforum = setattachtoforum
        # ----------------------------------
        self.KDialog = KDialog
        self.FileChooser = FileChooser
        self.SelectColor = SelectColor
        self.CustomSpinner = CustomSpinner
        self.PageSendMail = PageSendMail
        self.ScrollButton = ScrollButton
        self.ThemesForum = ThemesForum
        self.AboutDialog = AboutDialog
        self.UploadFiles = UploadFiles
        self.MessageViewer = MessageViewer
        self.MailList = MailList
        self.BugReporter = BugReporter
        self.ImageViewer = ImageViewer
        self.customspinner = customspinner
        self._urllib = _urllib
        self.traceback = traceback
        # ----------------------------------
        self.clipboard = clipboard
        # ----------------------------------
        self.theme_decorator_window = core.theme_decorator_window
项目:kivy_soil    作者:Bakterija    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(HoverBehavior, self).__init__(**kwargs)
        self.bind(parent=self._on_parent_update_hover)
项目:kivy_soil    作者:Bakterija    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        self.register_event_type('on_focus_textinput')
        super(FocusBehavior, self).__init__(**kwargs)
        self.fbind('focus', self.remove_other_focused)
        self.fbind('is_focusable', self.update_is_focusable)
        if not self.is_subfocus:
            self.bind(parent=on_parent)
            if self.grab_focus and self.is_focusable:
                self.focus_widget(self)
项目:kivy_soil    作者:Bakterija    | 项目源码 | 文件源码
def on_is_subfocus(self, _, value):
        if value:
            self.funbind('parent', on_parent)
            self.remove_from_focus()
        else:
            self.bind(parent=on_parent)
项目:Chess-Clock    作者:engSERGIU    | 项目源码 | 文件源码
def __init__(self,**kwargs):
            super(Main,self).__init__(**kwargs)
            Window.bind(on_keyboard=self.my_key_handler)
项目:kveditor    作者:gottadiveintopython    | 项目源码 | 文件源码
def kve_start(self):
        r'''????????????????????????Method'''

        Window.bind(on_keyboard=self.on_keyboard)
项目:AssembleAudio    作者:The-White-Wolf    | 项目源码 | 文件源码
def create_grid(self, x_hint_list, rows_to_create):
        #x_hint_list is a list of ints, relating to the intended
        #width of each column in the grid.

        for row in range(rows_to_create):
            for x_hint in x_hint_list:
                grid_button = Button(text = '', valign = 'middle', shorten = True, size_hint_y = None,
                    height = 30,  size_hint_x = x_hint, background_color = cfg_primary_neutral,
                    background_normal = '', color = cfg_primary_dark)

                grid_button.bind(size=grid_button.setter('text_size'))
                grid_button.bind(on_touch_down=self.button_press)
                self.add_widget(grid_button)
        self._avail += rows_to_create
项目:AssembleAudio    作者:The-White-Wolf    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(EditingGrid, self).__init__(**kwargs)
        self.create_grid(EditingGrid.x_hint_list, 30)
        Window.bind(on_dropfile=self.file_drop)
项目:AssembleAudio    作者:The-White-Wolf    | 项目源码 | 文件源码
def create_stats(self):
        num_labels = 74 * 2
        for i in range(num_labels):
            label = Label(shorten=True)
            label.bind(size=label.setter('text_size'))
            self.add_widget(label)
        self.get_stats()
项目:Tutoriales-Kivy-Espa-ol    作者:IvanDragogear    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(MotorJuego, self).__init__(**kwargs)
        Window.bind(on_key_down=self.Key_Down)
        Window.bind(on_key_up=self.Key_Up)
        self.gameworld.init_gameworld(
            ['renderer','position','color'],
            callback=self.init_game)
项目:Blogs-Posts-Tutorials    作者:kiok46    | 项目源码 | 文件源码
def __init__(self, parent):
        super(DaySelector, self).__init__()
        self.parent_class = parent
        self.parent_class.add_widget(self, index=7)
        self.selected_widget = None
        Window.bind(on_resize=self.move_resize)
项目:Blogs-Posts-Tutorials    作者:kiok46    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(ThemeManager, self).__init__(**kwargs)
        self.rec_shadow = Atlas('{}rec_shadow.atlas'.format(images_path))
        self.rec_st_shadow = Atlas('{}rec_st_shadow.atlas'.format(images_path))
        self.quad_shadow = Atlas('{}quad_shadow.atlas'.format(images_path))
        self.round_shadow = Atlas('{}round_shadow.atlas'.format(images_path))
        Clock.schedule_once(lambda x: self.on_theme_style(0, self.theme_style))
        self._determine_device_orientation(None, Window.size)
        Window.bind(size=self._determine_device_orientation)
项目:mobileinsight-mobile    作者:mobile-insight    | 项目源码 | 文件源码
def __init__(self, parent):
        super(DaySelector, self).__init__()
        self.parent_class = parent
        self.parent_class.add_widget(self, index=7)
        self.selected_widget = None
        Window.bind(on_resize=self.move_resize)
项目:mobileinsight-mobile    作者:mobile-insight    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(ThemeManager, self).__init__(**kwargs)
        self.rec_shadow = Atlas('{}rec_shadow.atlas'.format(images_path))
        self.rec_st_shadow = Atlas('{}rec_st_shadow.atlas'.format(images_path))
        self.quad_shadow = Atlas('{}quad_shadow.atlas'.format(images_path))
        self.round_shadow = Atlas('{}round_shadow.atlas'.format(images_path))
        Clock.schedule_once(lambda x: self.on_theme_style(0, self.theme_style))
        self._determine_device_orientation(None, Window.size)
        Window.bind(size=self._determine_device_orientation)
项目:mobileinsight-mobile    作者:mobile-insight    | 项目源码 | 文件源码
def __init__(self, panel, height, tab):
        self.panel = panel
        self.height = height
        self.tab = tab
        super(MDBottomNavigationHeader, self).__init__()
        self._current_color = self.theme_cls.disabled_hint_text_color
        self._label = self.ids._label
        self._label_font_size = sp(12)
        self.theme_cls.bind(primary_color=self._update_theme_color,
                            disabled_hint_text_color=self._update_theme_style)
        self.active = False
项目:mobileinsight-mobile    作者:mobile-insight    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(MDBottomNavigation, self).__init__(**kwargs)
        self.previous_tab = None
        self.widget_index = 0
        self._refresh_tabs()
        Window.bind(on_resize=self.on_resize)
        Clock.schedule_once(lambda x: self.on_resize(), 2)
项目:RKSV    作者:ztp-at    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(VerifyReceiptWidget, self).__init__(**kwargs)
        if platform == 'android':
            pm = PythonActivity.mActivity.getPackageManager()
            if not pm.hasSystemFeature(PM.FEATURE_CAMERA):
                return

            def addCamButton(instance):
                self.loadLayout.add_widget(Button(size_hint=(None, 1),
                        text='C', on_press=self.takePicture))
            Clock.schedule_once(addCamButton, 0)
            activity.bind(on_activity_result=self.takePictureCb)
项目:RKSV    作者:ztp-at    | 项目源码 | 文件源码
def viewReceipt(self, btn):
        try:
            recs, cert, cert_list = self.dep[btn.group_id]
            jws = recs[btn.receipt_id]
            rec, prefix = receipt.Receipt.fromJWSString(jws)

            self._receipt_view = getModalView()
            content = ViewReceiptWidget(rec, prefix, self._verified,
                    self.aesInput.text, cancel=self._receipt_view.dismiss)
            self._receipt_view.add_widget(content)
            self._receipt_view.bind(on_open=content.firstDisplay)
            self._receipt_view.open()
        except receipt.ReceiptException as e:
            displayError(e)
项目:RKSV    作者:ztp-at    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(VerifyReceiptWidget, self).__init__(**kwargs)
        if platform == 'android':
            pm = PythonActivity.mActivity.getPackageManager()
            if not pm.hasSystemFeature(PM.FEATURE_CAMERA):
                return

            def addCamButton(instance):
                self.loadLayout.add_widget(Button(size_hint=(None, 1),
                        text='C', on_press=self.takePicture))
            Clock.schedule_once(addCamButton, 0)
            activity.bind(on_activity_result=self.takePictureCb)
项目:RKSV    作者:ztp-at    | 项目源码 | 文件源码
def viewReceipt(self, btn):
        try:
            recs, cert, cert_list = self.dep[btn.group_id]
            jws = recs[btn.receipt_id]
            rec, prefix = receipt.Receipt.fromJWSString(jws)

            self._receipt_view = getModalView()
            content = ViewReceiptWidget(rec, prefix, self._verified,
                    self.aesInput.text, cancel=self._receipt_view.dismiss)
            self._receipt_view.add_widget(content)
            self._receipt_view.bind(on_open=content.firstDisplay)
            self._receipt_view.open()
        except receipt.ReceiptException as e:
            displayError(e)
项目:Easy    作者:HeaTTheatR    | 项目源码 | 文件源码
def __init__(self, **kvargs):
        super(Program, self).__init__(**kvargs)
        Window.bind(on_keyboard=self.events_program)

        # ??? ??????? ????????? ? programclass.
        self.Screen = Screen
        self.Clock = Clock
        self.CustomMenuItem = CustomMenuItem
        self.KDialog = KDialog
        self.BDialog = BDialog
        self.Manifest = Manifest
        self.SwapTransition = SwapTransition
        self.choice = choice
        self.get_color_from_hex = get_color_from_hex
        self.get_hex_from_color = get_hex_from_color
        self.core = core
        self.name_program = core.string_lang_title
        self.navigation_drawer = NavigationDrawer(side_panel_width=230)
        self.current_open_tab = core.string_lang_tabbed_menu_shops
        self.shop = False  # ????????? ???????
        self.open_dialog = False  # ??????? ?????????? ????

        self.effects_transition = (SlideTransition, SwapTransition)
        # ?????? ?????????.
        self.shops = core.dict_shops.keys()
        # ?????? ???????.
        self.locations = [
            location.split('.')[0].lower() for location in os.listdir(
                '{}/Data/Images/locations'.format(core.prog_path))]
项目:SuperOcto    作者:mcecchi    | 项目源码 | 文件源码
def start(self, bl_interval):
      """Start blanking system. Screen will blank after bl_interval seconds."""
      if bl_interval > 0:
        self.bl_interval = bl_interval
        self._schedule()
        Window.bind(on_touch_down=self._on_window_touch_down)
项目:kivy_rpg    作者:spinningD20    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(GameApp, self).__init__(**kwargs)
        print('app init')
        Window.bind(on_resize=self.resize)

    #
    # def on_start(self):
    #     self.profile = cProfile.Profile()
    #     self.profile.enable()
    #
    #
    # def on_stop(self):
    #     self.profile.disable()
    #     self.profile.dump_stats('myapp.profile')
项目:kivy_rpg    作者:spinningD20    | 项目源码 | 文件源码
def new_game(self, choice='clyde'):
        print('new game')
        # get numbers of last save files to find an appropriate save file id to provide copying
        # make this beast a lot shorter sometime soon.  Probably just iterate over files with choice in them, inc
        # all_tmx_files_to_db() # update seed file for any changes from tmx files before copying it to use
        save_number = 0
        for rootdir, dir, files in os.walk(SAVE_PATH):
            current_number = len(fnmatch.filter(files, choice + '*.save'))
            if current_number > save_number:
                save_number = current_number
        save_number += 1
        filename = choice + '-' + str(save_number)
        while os.path.isfile(SAVE_PATH + filename + '.save'):
            filename += '0'
        filename = SAVE_PATH + filename + '.save'
        # copy seed db file with name of filename to make a new save file
        copyfile(os.path.join(runpath, 'seed.db'), filename)
        engine = create_engine('sqlite:///' + filename)
        Session = sessionmaker(bind=engine)  # configure session object
        self.db = Session()
        # set player flags like main_character, player_party, etc
        player_character_flag = self.db.query(GameFlag).filter(GameFlag.name == 'player_character').first()
        if not player_character_flag:
            player_character_flag = GameFlag()
            player_character_flag.name = 'player_character'
        player_character_flag.value = choice
        # MAYBE TO-DO : find clyde map object and set its coords and map_id to values for clyde choice?
        # FOR NOW, commit changes
        self.db.add(player_character_flag)
        self.db.commit()
        print('save file created...loading', filename)
        self.load_game(filename)
项目:kivy_rpg    作者:spinningD20    | 项目源码 | 文件源码
def load_game(self, filename=os.path.join(runpath, 'seed.db')):
        print('hitting load game')
        # set the db here, get current map player object was last at, and load that map
        engine = create_engine('sqlite:///' + filename)
        Session = sessionmaker(bind=engine)  # configure session object
        self.db = Session()
        # until the other characters are in the db, trying to load a game with anyone but clyde will crash
        player_character_flag = self.db.query(GameFlag).filter(GameFlag.name == 'player_character').first()
        self.player_object = self.db.query(MapObject).filter(MapObject.name == player_character_flag.value).first()
        tilemap = self.db.query(TileMap).filter(TileMap.id == self.player_object.map_id).first()
        self.manager.current = 'Game'
        self.load_map(tilemap.file_name)
项目:kivy_gosh    作者:mcroni    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(Jarvis, self).__init__(**kwargs)
        Win.bind(on_keyboard=self.onBackBtn)
项目:kivy_gosh    作者:mcroni    | 项目源码 | 文件源码
def build(self):
        self.title = "GoshenApp"
        #from kivy.core.window import Window
        #Window.size = (450, 600)
        #self.service = None
        self.start_service()
        osc.init()
        oscid = osc.listen(port=3002)
        osc.bind(oscid, self.display_message, '/message')
        Clock.schedule_interval(lambda *x: osc.readQueue(oscid), 0)
        self.theme_cls.theme_style = 'Dark'
        self.theme_cls.primary_palette = 'Indigo'
        self.nav_drawer = Drawer()
        return GbeeRoot()
项目:kivy_gosh    作者:mcroni    | 项目源码 | 文件源码
def __init__(self, parent):
        super(DaySelector, self).__init__()
        self.parent_class = parent
        self.parent_class.add_widget(self, index=7)
        self.selected_widget = None
        Window.bind(on_resize=self.move_resize)
项目:kivy_gosh    作者:mcroni    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(ThemeManager, self).__init__(**kwargs)
        self.rec_shadow = Atlas('{}rec_shadow.atlas'.format(images_path))
        self.rec_st_shadow = Atlas('{}rec_st_shadow.atlas'.format(images_path))
        self.quad_shadow = Atlas('{}quad_shadow.atlas'.format(images_path))
        self.round_shadow = Atlas('{}round_shadow.atlas'.format(images_path))
        Clock.schedule_once(lambda x: self.on_theme_style(0, self.theme_style))
        self._determine_device_orientation(None, Window.size)
        Window.bind(size=self._determine_device_orientation)
项目:kivy_gosh    作者:mcroni    | 项目源码 | 文件源码
def __init__(self, panel, height, tab):
        self.panel = panel
        self.height = height
        self.tab = tab
        super(MDBottomNavigationHeader, self).__init__()
        self._current_color = self.theme_cls.disabled_hint_text_color
        self._label = self.ids._label
        self._label_font_size = sp(12)
        self.theme_cls.bind(primary_color=self._update_theme_color,
                            disabled_hint_text_color=self._update_theme_style)
        self.active = False
项目:KivyMD    作者:cruor99    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(ThemeManager, self).__init__(**kwargs)
        self.rec_shadow = Atlas('{}rec_shadow.atlas'.format(images_path))
        self.rec_st_shadow = Atlas('{}rec_st_shadow.atlas'.format(images_path))
        self.quad_shadow = Atlas('{}quad_shadow.atlas'.format(images_path))
        self.round_shadow = Atlas('{}round_shadow.atlas'.format(images_path))
        Clock.schedule_once(lambda x: self.on_theme_style(0, self.theme_style))
        self._determine_device_orientation(None, Window.size)
        Window.bind(size=self._determine_device_orientation)
项目:SerpentAI    作者:SerpentAI    | 项目源码 | 文件源码
def __init__(self):
        super().__init__()

        self.images = dict()

        self.root = FloatLayout(size=(Window.width, Window.height))
        self.grid = GridLayout(cols=8)

        self.add_widget(self.root)
        self.root.add_widget(self.grid)

        for i, bucket in enumerate(config["visual_debugger"]["available_buckets"]):
            layout = BoxLayout(orientation="vertical")

            image = VisualDebuggerImage(
                allow_stretch=True
            )

            image.bind(texture=image.update_texture_filters)

            self.images[bucket] = image

            layout.add_widget(image)

            label = Label(
                text=bucket,
                color=(1, 1, 1, 1),
                size_hint=(1, 0.1)
            )

            layout.add_widget(label)

            self.grid.add_widget(layout)

        Window.bind(on_resize=self.on_window_resize)
        Window.clearcolor = (0.136, 0.191, 0.25, 1)
项目:DemoKivyContacts    作者:HeaTTheatR    | 项目源码 | 文件源码
def __init__(self, **kvargs):
        super(Program, self).__init__(**kvargs)
        Window.bind(on_keyboard=self.events_program)

        self.window = Window
        self.dialog_load_contact = None
        self.open_exit_dialog = None
        self.scren_add_groups = None  # kivy.lang.builder.AddContactAddGroups
        self.data = data
        self.current_tab = 'contacts'
        self.load_all_kv_files()
项目:garden.resizable_behavior    作者:kivy-garden    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(ResizableBehavior, self).__init__(**kwargs)
        Window.bind(mouse_pos=self.on_mouse_move)
        Clock.schedule_once(_modalview.put_on_top, 0)
        self.oldpos, self.oldsize = [], []
项目:mmplayer    作者:Bakterija    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(HoverBehavior, self).__init__(**kwargs)
        self.bind(parent=self._on_parent_update_hover)
项目:mmplayer    作者:Bakterija    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        self.register_event_type('on_focus_textinput')
        super(FocusBehavior, self).__init__(**kwargs)
        self.fbind('focus', self.remove_other_focused)
        self.fbind('is_focusable', self.update_is_focusable)
        if not self.is_subfocus:
            self.bind(parent=on_parent)
            if self.grab_focus and self.is_focusable:
                self.focus_widget(self)