当前位置: 首页>>代码示例>>Python>>正文


Python Window.size方法代码示例

本文整理汇总了Python中kivy.core.window.Window.size方法的典型用法代码示例。如果您正苦于以下问题:Python Window.size方法的具体用法?Python Window.size怎么用?Python Window.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kivy.core.window.Window的用法示例。


在下文中一共展示了Window.size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _list_sdcard_results

# 需要导入模块: from kivy.core.window import Window [as 别名]
# 或者: from kivy.core.window.Window import size [as 别名]
def _list_sdcard_results(self, l):
        # dismiss waiting dialog
        fl = {}
        for f in l:
            f = '/sd/{}'.format(f)
            # if f.endswith('/'):
            #     fl[f[:-1]] = {'size': 0, 'isdir': True}
            # else:
            #     fl[f] = {'size': 0, 'isdir': False}

            # as we can't handle subdirectories yet we do not list them
            if not f.endswith('/'):
                fl[f] = {'size': 0, 'isdir': False}

        # get file to print
        f = FileDialog()
        f.open(title='SD File to print', file_list=fl, cb=self._start_sd_print) 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:19,代码来源:main.py

示例2: window_request_close

# 需要导入模块: from kivy.core.window import Window [as 别名]
# 或者: from kivy.core.window.Window import size [as 别名]
def window_request_close(self, win):
        if self.desktop_changed:
            # if the desktop changed we reset the window size and pos
            if self.config.get('UI', 'screen_size') != 'none':
                self.config.set('UI', 'screen_size', 'auto')
            if self.config.get('UI', 'screen_pos') != 'none':
                self.config.set('UI', 'screen_pos', 'auto')

            self.config.write()

        elif self.is_desktop == 2 or self.is_desktop == 3:
            if self.config.get('UI', 'screen_size') != 'none':
                # Window.size is automatically adjusted for density, must divide by density when saving size
                self.config.set('UI', 'screen_size', "{}x{}".format(int(Window.size[0] / Metrics.density), int(Window.size[1] / Metrics.density)))

            if self.config.get('UI', 'screen_pos') != 'none':
                self.config.set('UI', 'screen_pos', "{},{}".format(Window.top, Window.left))
                Logger.info('SmoothieHost: close Window.size: {}, Window.top: {}, Window.left: {}'.format(Window.size, Window.top, Window.left))

            self.config.write()

        return False 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:24,代码来源:main.py

示例3: draw_mathtext

# 需要导入模块: from kivy.core.window import Window [as 别名]
# 或者: from kivy.core.window.Window import size [as 别名]
def draw_mathtext(self, gc, x, y, s, prop, angle):
        '''Draw the math text using matplotlib.mathtext. The position
           x,y is given in Kivy coordinates.
        '''
        ftimage, depth = self.mathtext_parser.parse(s, self.dpi, prop)
        w = ftimage.get_width()
        h = ftimage.get_height()
        texture = Texture.create(size=(w, h))
        if _mpl_ge_1_5:
            texture.blit_buffer(ftimage.as_rgba_str()[0][0], colorfmt='rgba',
                                bufferfmt='ubyte')
        else:
            texture.blit_buffer(ftimage.as_rgba_str(), colorfmt='rgba',
                                bufferfmt='ubyte')
        texture.flip_vertical()
        with self.widget.canvas:
            Rectangle(texture=texture, pos=(x, y), size=(w, h)) 
开发者ID:kivy-garden,项目名称:garden.matplotlib,代码行数:19,代码来源:backend_kivy.py

示例4: get_text_width_height_descent

# 需要导入模块: from kivy.core.window import Window [as 别名]
# 或者: from kivy.core.window.Window import size [as 别名]
def get_text_width_height_descent(self, s, prop, ismath):
        '''This method is needed specifically to calculate text positioning
           in the canvas. Matplotlib needs the size to calculate the points
           according to their layout
        '''
        if ismath:
            ftimage, depth = self.mathtext_parser.parse(s, self.dpi, prop)
            w = ftimage.get_width()
            h = ftimage.get_height()
            return w, h, depth
        font = resource_find(prop.get_name() + ".ttf")
        if font is None:
            plot_text = CoreLabel(font_size=prop.get_size_in_points())
        else:
            plot_text = CoreLabel(font_size=prop.get_size_in_points(),
                            font_name=prop.get_name())
        plot_text.text = six.text_type("{}".format(s))
        plot_text.refresh()
        return plot_text.texture.size[0], plot_text.texture.size[1], 1 
开发者ID:kivy-garden,项目名称:garden.matplotlib,代码行数:21,代码来源:backend_kivy.py

示例5: get_fixed_points

# 需要导入模块: from kivy.core.window import Window [as 别名]
# 或者: from kivy.core.window.Window import size [as 别名]
def get_fixed_points(self, x, y, move=False):
        # _size = EventLoop.window.system_size
        _size = Window.size
        _size = self.size
        if move:
            _x = x / _size[0]
            _y = y / _size[1]
            return _x * self.MPICKING_BUFFER_SIZE[0], _y * self.MPICKING_BUFFER_SIZE[1]

        #_x = x / _size[0]
        #_y = y / _size[1]
        pos = self.parent.pos
        if x < pos[0] or x > pos[0]+_size[0] or y < pos[1] or y > pos[1]+_size[1]:
            return -1, -1

        _x = (x-pos[0]) / _size[0]
        _y = (y-pos[1]) / _size[1]

        return _x * self.MPICKING_BUFFER_SIZE[0], _y * self.MPICKING_BUFFER_SIZE[1] 
开发者ID:kpiorno,项目名称:kivy3dgui,代码行数:21,代码来源:canvas3d.py

示例6: get_zoom_for_radius

# 需要导入模块: from kivy.core.window import Window [as 别名]
# 或者: from kivy.core.window.Window import size [as 别名]
def get_zoom_for_radius(radius_km, lat=None, tile_size=256.):
    """See: https://wiki.openstreetmap.org/wiki/Zoom_levels"""
    radius = radius_km * 1000.
    if lat is None:
        lat = 0.  # Do not compensate for the latitude

    # Calculate the equatorial circumference based on the WGS-84 radius
    earth_circumference = 2. * pi * 6378137. * cos(lat * pi / 180.)

    # Check how many tiles that are currently in view
    nr_tiles_shown = min(Window.size) / dp(tile_size)

    # Keep zooming in until we find a zoom level where the circle can fit inside the screen
    zoom = 1
    while earth_circumference / (2 << (zoom - 1)) * nr_tiles_shown > 2 * radius:
        zoom += 1
    return zoom - 1  # Go one zoom level back 
开发者ID:kivy-garden,项目名称:garden.mapview,代码行数:19,代码来源:utils.py

示例7: show_dialog

# 需要导入模块: from kivy.core.window import Window [as 别名]
# 或者: from kivy.core.window.Window import size [as 别名]
def show_dialog(self, title, message, qrdata=None, cb=None):
        if qrdata:
            dialog_height = 300
            content = QRCodeWidget(data=qrdata,
                                   size=(dp(150), dp(150)),
                                   size_hint=(None, None))
        else:
            dialog_height = 200
            content = MDLabel(font_style='Body1',
                              theme_text_color='Secondary',
                              text=message,
                              size_hint_y=None,
                              valign='top')
            content.bind(texture_size=content.setter('size'))
        self.dialog = MDDialog(title=title,
                               content=content,
                               size_hint=(.8, None),
                               height=dp(dialog_height),
                               auto_dismiss=False)

        self.dialog.add_action_button(
            "Dismiss", action=cb if cb else lambda *x: self.dialog.dismiss())
        self.dialog.open() 
开发者ID:metamarcdw,项目名称:nowallet,代码行数:25,代码来源:main.py

示例8: _heading

# 需要导入模块: from kivy.core.window import Window [as 别名]
# 或者: from kivy.core.window.Window import size [as 别名]
def _heading(game, view):
    heading = Label(font_name='DroidSans-Regular.ttf', font_size=18,
                    color=HEADING_COLOR, markup=False)
    heading.pos = (ANIM_TOGGLE_SIZE, 500 - PADDING)
    heading.size = (960 - ANIM_TOGGLE_SIZE * 2, HEIGHT)
    view.add_widget(heading)

    def state_change(btn, state):
        game.set_animooted(state == 'down')

    anim_toggle = ToggleButton(background_normal='media/chkbox.png',
                               background_down='media/chkbox_a.png',
                               border=(0, 0, 0, 20), font_size=15,
                               text='Display Animations', state='down',
                               color=HEADING_COLOR, markup=False)
    anim_toggle.pos = (965 - ANIM_TOGGLE_SIZE, 510 - PADDING)
    anim_toggle.size = (ANIM_TOGGLE_SIZE, 30)
    anim_toggle.bind(state=state_change)
    view.add_widget(anim_toggle)

    game._heading = heading
    game.update_heading() 
开发者ID:mvasilkov,项目名称:kivy-2014,代码行数:24,代码来源:ui.py

示例9: init_ui

# 需要导入模块: from kivy.core.window import Window [as 别名]
# 或者: from kivy.core.window.Window import size [as 别名]
def init_ui(game):
    view = Widget()

    _heading(game, view)
    _notes(game, view)
    _scales(game, view)
    _tuning(game, view)

    view.add_widget(game)

    if platform in ('android', 'ios'):
        from kivy.core.window import Window
        from kivy.uix.scrollview import ScrollView

        app_view = view
        app_view.size = (960, 540)
        app_view.size_hint = (None, None)

        view = ScrollView(size=Window.size)
        view.effect_cls = ScrollEffect
        view.add_widget(app_view)

    return view 
开发者ID:mvasilkov,项目名称:kivy-2014,代码行数:25,代码来源:ui.py

示例10: __init__

# 需要导入模块: from kivy.core.window import Window [as 别名]
# 或者: from kivy.core.window.Window import size [as 别名]
def __init__(self, **kwargs):
        super(MainWindow, self).__init__(**kwargs)
        self.app = App.get_running_app()
        self._trigger = Clock.create_trigger(self.async_get_display_data)
        self._q = queue.Queue()
        self.config = self.app.config
        self.last_path = self.config.get('General', 'last_gcode_path')
        self.paused = False
        self.last_line = 0

        # print('font size: {}'.format(self.ids.log_window.font_size))
        # Clock.schedule_once(self.my_callback, 2) # hack to overcome the page layout not laying out initially 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:14,代码来源:main.py

示例11: __init__

# 需要导入模块: from kivy.core.window import Window [as 别名]
# 或者: from kivy.core.window.Window import size [as 别名]
def __init__(self, comms=None, **kwargs):
        super(GcodeViewerScreen, self).__init__(**kwargs)
        self.app = App.get_running_app()
        self.last_file_pos = None
        self.canv = InstructionGroup()
        self.bind(pos=self._redraw, size=self._redraw)
        self.last_target_layer = 0
        self.tx = 0
        self.ty = 0
        self.scale = 1.0
        self.comms = comms
        self.twod_mode = self.app.is_cnc
        self.rval = 0.0 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:15,代码来源:viewer.py

示例12: start_cursor

# 需要导入模块: from kivy.core.window import Window [as 别名]
# 或者: from kivy.core.window.Window import size [as 别名]
def start_cursor(self, x, y):
        tx, ty = self.transform_to_wpos(x, y)
        label = CoreLabel(text="{:1.2f},{:1.2f}".format(tx, ty))
        label.refresh()
        texture = label.texture
        px, py = (x, y)
        with self.ids.surface.canvas.after:
            Color(0, 0, 1, mode='rgb', group='cursor_group')
            self.crossx = [
                Rectangle(pos=(px, 0), size=(1, self.height), group='cursor_group'),
                Rectangle(pos=(0, py), size=(self.width, 1), group='cursor_group'),
                Line(circle=(px, py, 20), group='cursor_group'),
                Rectangle(texture=texture, pos=(px - texture.size[0] / 2, py - 40), size=texture.size, group='cursor_group')
            ] 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:16,代码来源:viewer.py

示例13: build

# 需要导入模块: from kivy.core.window import Window [as 别名]
# 或者: from kivy.core.window.Window import size [as 别名]
def build(self):
            Window.size = (1024, 768)
            self.sm = ScreenManager()
            self.sm.add_widget(StartScreen(name='start'))
            self.sm.add_widget(GcodeViewerScreen(name='gcode'))
            self.sm.add_widget(ExitScreen(name='main'))
            self.sm.current = 'gcode'

            level = LOG_LEVELS.get('debug') if len(sys.argv) > 2 else LOG_LEVELS.get('info')
            Logger.setLevel(level=level)
            # logging.getLogger().setLevel(logging.DEBUG)
            return self.sm 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:14,代码来源:viewer.py

示例14: handle_clip_rectangle

# 需要导入模块: from kivy.core.window import Window [as 别名]
# 或者: from kivy.core.window.Window import size [as 别名]
def handle_clip_rectangle(self, gc, x, y):
        '''It checks whether the point (x,y) collides with any already
           existent stencil. If so it returns the index position of the
           stencil it collides with. if the new clip rectangle bounds are
           None it draws in the canvas otherwise it finds the correspondent
           stencil or creates a new one for the new graphics instructions.
           The point x,y is given in matplotlib coordinates.
        '''
        x = self.widget.x + x
        y = self.widget.y + y
        collides = self.collides_with_existent_stencil(x, y)
        if collides > -1:
            return collides
        new_bounds = gc.get_clip_rectangle()
        if new_bounds:
            x = self.widget.x + int(new_bounds.bounds[0])
            y = self.widget.y + int(new_bounds.bounds[1])
            w = int(new_bounds.bounds[2])
            h = int(new_bounds.bounds[3])
            collides = self.collides_with_existent_stencil(x, y)
            if collides == -1:
                cliparea = StencilView(pos=(x, y), size=(w, h))
                self.clip_rectangles.append(cliparea)
                self.widget.add_widget(cliparea)
                return len(self.clip_rectangles) - 1
            else:
                return collides
        else:
            return -2 
开发者ID:kivy-garden,项目名称:garden.matplotlib,代码行数:31,代码来源:backend_kivy.py

示例15: __init__

# 需要导入模块: from kivy.core.window import Window [as 别名]
# 或者: from kivy.core.window.Window import size [as 别名]
def __init__(self, canvas, **kwargs):
        self.actionbar = ActionBar(pos_hint={'top': 1.0})
        super(NavigationToolbar2Kivy, self).__init__(canvas)
        self.rubberband_color = (1.0, 0.0, 0.0, 1.0)
        self.lastrect = None
        self.save_dialog = Builder.load_string(textwrap.dedent('''\
            <SaveDialog>:
                text_input: text_input
                BoxLayout:
                    size: root.size
                    pos: root.pos
                    orientation: "vertical"
                    FileChooserListView:
                        id: filechooser
                        on_selection: text_input.text = self.selection and\
                        self.selection[0] or ''

                    TextInput:
                        id: text_input
                        size_hint_y: None
                        height: 30
                        multiline: False

                    BoxLayout:
                        size_hint_y: None
                        height: 30
                        Button:
                            text: "Cancel"
                            on_release: root.cancel()

                        Button:
                            text: "Save"
                            on_release: root.save(filechooser.path,\
                            text_input.text)
            ''')) 
开发者ID:kivy-garden,项目名称:garden.matplotlib,代码行数:37,代码来源:backend_kivy.py


注:本文中的kivy.core.window.Window.size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。