當前位置: 首頁>>代碼示例>>Python>>正文


Python Window.height方法代碼示例

本文整理匯總了Python中kivy.core.window.Window.height方法的典型用法代碼示例。如果您正苦於以下問題:Python Window.height方法的具體用法?Python Window.height怎麽用?Python Window.height使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在kivy.core.window.Window的用法示例。


在下文中一共展示了Window.height方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: drawWorkspace

# 需要導入模塊: from kivy.core.window import Window [as 別名]
# 或者: from kivy.core.window.Window import height [as 別名]
def drawWorkspace(self, *args):

        self.scatterObject.canvas.remove_group('workspace')
 
        with self.scatterObject.canvas:
            Color(.47, .47, .47)

            #create the bounding box
            height = float(self.data.config.get('Maslow Settings', 'bedHeight'))
            width  = float(self.data.config.get('Maslow Settings', 'bedWidth'))
            Line(points = ( -width/2 , -height/2 ,  width/2 , -height/2), group='workspace')
            Line(points = ( -width/2 ,  height/2 ,  width/2 ,  height/2), group='workspace')
            Line(points = ( -width/2 , -height/2 , -width/2 ,  height/2), group='workspace')
            Line(points = (  width/2 , -height/2 ,  width/2 ,  height/2), group='workspace')
            
            #create the axis lines
            Line(points = (-width/2,0,width/2,0), dash_offset = 5, group='workspace')
            Line(points = (0, -height/2,0,height/2), dash_offset = 5, group='workspace')
    
            texture = self.data.backgroundTexture
            if texture is not None:
                Rectangle(texture=texture, pos=(-width/2, -height/2), 
                          size=(width, height),
                          tex_coords=self.data.backgroundManualReg) 
開發者ID:MaslowCNC,項目名稱:GroundControl,代碼行數:26,代碼來源:gcodeCanvas.py

示例2: rescale_interface

# 需要導入模塊: from kivy.core.window import Window [as 別名]
# 或者: from kivy.core.window.Window import height [as 別名]
def rescale_interface(self, *_, force=False):
        if self.last_width == 0:
            first_change = True
        else:
            first_change = False
        if Window.width != self.last_width or force:
            self.popup_x = int(Window.width * .75)
            self.last_width = Window.width
            if first_change:
                Clock.schedule_once(lambda x: self.rescale_interface(force=True))
                return
            if desktop:
                button_multiplier = 1
            else:
                button_multiplier = 2
            self.button_scale = int((Window.height / interface_multiplier) * int(self.config.get("Settings", "buttonsize")) / 100) * button_multiplier
            self.padding = self.button_scale / 4
            self.text_scale = int((self.button_scale / 3) * int(self.config.get("Settings", "textsize")) / 100)
            if self.standalone:
                Clock.schedule_once(lambda x: self.show_album())
            else:
                Clock.schedule_once(self.show_database) 
開發者ID:snuq,項目名稱:Snu-Photo-Manager,代碼行數:24,代碼來源:main.py

示例3: showChannelConfigDialog

# 需要導入模塊: from kivy.core.window import Window [as 別名]
# 或者: from kivy.core.window.Window import height [as 別名]
def showChannelConfigDialog(self):

        def popup_dismissed(instance):
            self.settings.userPrefs.set_alertrules(self.channel, alertrules)
            self.dashboard_state.clear_channel_states(self.channel)

        alertrules = self.settings.userPrefs.get_alertrules(self.channel)

        content = AlertRulesView(alertrules, channel=self.channel)
        content.min_value = self.min
        content.max_value = self.max
        content.precision = self.precision

        popup = Popup(title='Customize {}'.format(self.channel),
                      content=content,
                      size=(min(Window.width, dp(700)), min(Window.height, dp(400))),
                      size_hint=(None, None))
        popup.bind(on_dismiss=popup_dismissed)
        content.bind(title=lambda i, t: setattr(popup, 'title', t))
        popup.open() 
開發者ID:autosportlabs,項目名稱:RaceCapture_App,代碼行數:22,代碼來源:gauge.py

示例4: _add_new_action

# 需要導入模塊: from kivy.core.window import Window [as 別名]
# 或者: from kivy.core.window.Window import height [as 別名]
def _add_new_action(self, *args):
        def popup_dismissed(instance, result):
            if result:
                selected = instance.content.selected_item
                if selected is not None:
                    alertaction = selected.key
                    self.alertrule.alert_actions.append(alertaction)
                    self.dispatch('on_edit_action', alertaction)
                    self.refresh_view()
            popup.dismiss()

        alertaction_prototypes = get_alertaction_default_collection(exclude_filter=self.alertrule.alert_actions)

        items = [ItemSelectionRef(title=alertaction.title, image_source=alertaction.PREVIEW_IMAGE, key=alertaction) for alertaction in alertaction_prototypes]

        if len(items) == 0:
            toast('No more actions available')
        else:
            view = ItemSelectorView(item_references=items)
            popup = editor_popup('Select Action', view,
                                 popup_dismissed,
                                 size_hint=(None, None),
                                 size=(min(Window.width, dp(700)), min(Window.height,dp(400))),
                                 auto_dismiss_time=10) 
開發者ID:autosportlabs,項目名稱:RaceCapture_App,代碼行數:26,代碼來源:alerteditor.py

示例5: _loaded

# 需要導入模塊: from kivy.core.window import Window [as 別名]
# 或者: from kivy.core.window.Window import height [as 別名]
def _loaded(self):
        Logger.debug("GcodeViewerScreen: in _loaded. ok: {}".format(self._loaded_ok))
        self.remove_widget(self.li)
        self.li = None
        self.ids.surface.canvas.add(self.canv)
        self.valid = self._loaded_ok
        if self._loaded_ok:
            # not sure why we need to do this
            self.ids.surface.top = Window.height
            if self.app.is_connected:
                self.app.bind(wpos=self.update_tool) 
開發者ID:wolfmanjm,項目名稱:kivy-smoothie-host,代碼行數:13,代碼來源:viewer.py

示例6: start_cursor

# 需要導入模塊: from kivy.core.window import Window [as 別名]
# 或者: from kivy.core.window.Window import height [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

示例7: set_auto_mouse_position

# 需要導入模塊: from kivy.core.window import Window [as 別名]
# 或者: from kivy.core.window.Window import height [as 別名]
def set_auto_mouse_position(widget):
    ''' functions trys to position widget
    automaticaly on the mouse pos'''

    if Window.mouse_pos[0]+widget.width > Window.width:
        widget.x = Window.mouse_pos[0]

    else:
        widget.x = Window.mouse_pos[0]
    
    if (Window.mouse_pos[1]+widget.height > Window.height):
        widget.top = Window.mouse_pos[1]-16
    else:
        widget.top = Window.mouse_pos[1]-16 
開發者ID:mahart-studio,項目名稱:kivystudio,代碼行數:16,代碼來源:__init__.py

示例8: moveToCenter

# 需要導入模塊: from kivy.core.window import Window [as 別名]
# 或者: from kivy.core.window.Window import height [as 別名]
def moveToCenter(self, *args):
        
        
        #This moves the simulation onto the screen, I would love if it were centered
        #but for now it doesn't adapt to screen size (Window.width, Window.height)
        
        moveVertical = self.bedHeight/1.4
        moveHorizontal = self.bedWidth/1.4
        
        mat = Matrix().translate(moveHorizontal, moveVertical, 0)
        self.scatterInstance.apply_transform(mat)
        
        #scale it down to fit on the screen
        self.scatterInstance.apply_transform(Matrix().scale(.3, .3, 1)) 
開發者ID:MaslowCNC,項目名稱:GroundControl,代碼行數:16,代碼來源:simulationCanvas.py

示例9: centerCanvas

# 需要導入模塊: from kivy.core.window import Window [as 別名]
# 或者: from kivy.core.window.Window import height [as 別名]
def centerCanvas(self, *args):
        '''
        
        Return the canvas to the center of the screen.
        
        '''
        mat = Matrix().translate(Window.width/2, Window.height/2, 0)
        self.scatterInstance.transform = mat
        
        anchor = (0,0)
        scale = self.data.config.get('Ground Control Settings', 'viewScale')
        mat = Matrix().scale(dp(scale), dp(scale), 1)

        self.scatterInstance.apply_transform(mat, anchor) 
開發者ID:MaslowCNC,項目名稱:GroundControl,代碼行數:16,代碼來源:gcodeCanvas.py

示例10: determine_banner_height

# 需要導入模塊: from kivy.core.window import Window [as 別名]
# 或者: from kivy.core.window.Window import height [as 別名]
def determine_banner_height(self):
        """ Utility function for determining the height (dp) of the banner ad.

            :return height: Height of banner ad in dp.
        """
        height = 32
        upper_bound = kivy.metrics.dp(720)
        if Window.height > upper_bound:
            height = 90
        elif (
            Window.height > kivy.metrics.dp(400)
            and Window.height <= upper_bound
        ):
            height = 50
        return height 
開發者ID:MichaelStott,項目名稱:KivMob,代碼行數:17,代碼來源:kivmob.py

示例11: popup_bubble

# 需要導入模塊: from kivy.core.window import Window [as 別名]
# 或者: from kivy.core.window.Window import height [as 別名]
def popup_bubble(self, text_input, pos):
        self.close_bubble()
        text_input.unfocus_on_touch = False
        self.bubble = InputMenu(owner=text_input)
        window = self.root_window
        window.add_widget(self.bubble)
        posx = pos[0]
        posy = pos[1]
        #check position to ensure its not off screen
        if posx + self.bubble.width > window.width:
            posx = window.width - self.bubble.width
        if posy + self.bubble.height > window.height:
            posy = window.height - self.bubble.height
        self.bubble.pos = [posx, posy] 
開發者ID:snuq,項目名稱:Snu-Photo-Manager,代碼行數:16,代碼來源:main.py

示例12: drag_treeview

# 需要導入模塊: from kivy.core.window import Window [as 別名]
# 或者: from kivy.core.window.Window import height [as 別名]
def drag_treeview(self, drag_object, mode, position, offset=list([0, 0])):
        """Updates the drag-n-drop widget for a treeview folder.
        Arguments:
            drag_object: The widget that is being dragged.
            mode: String, what is being done with the drag: 'start', 'end' or 'move'.
            position: The position (x, y) the drag widget should be at in window coordinates.
            offset: Needs to be provided if mode is 'start',
                    offset where the drag began, to make the image be placed in the correct location.
        """

        if mode == 'end':
            self.main_layout.remove_widget(self.drag_treenode)
            self.screen_manager.current_screen.drop_widget(drag_object.fullpath, position, dropped_type=drag_object.droptype, aspect=1)

        elif mode == 'start':
            self.drag_treenode.offset = offset
            self.main_layout.remove_widget(self.drag_treenode)
            self.drag_treenode.text = drag_object.folder_name
            if drag_object.subtext:
                self.drag_treenode.height = int(self.button_scale * 1.5)
                self.drag_treenode.subtext = drag_object.subtext
                self.drag_treenode.ids['subtext'].height = int(self.button_scale * 0.5)
            else:
                self.drag_treenode.subtext = ''
                self.drag_treenode.ids['subtext'].height = 0
                self.drag_treenode.height = int(self.button_scale * 1)
            self.drag_treenode.width = drag_object.width
            self.drag_treenode.pos = (position[0]-offset[0], position[1]-offset[1])
            self.main_layout.add_widget(self.drag_treenode)

        else:
            self.drag_treenode.pos = (position[0]-self.drag_treenode.offset[0], position[1]-self.drag_treenode.offset[1]) 
開發者ID:snuq,項目名稱:Snu-Photo-Manager,代碼行數:34,代碼來源:main.py

示例13: depack

# 需要導入模塊: from kivy.core.window import Window [as 別名]
# 或者: from kivy.core.window.Window import height [as 別名]
def depack(self, args):
        self.is_touch = True
        self.sx = args['x']
        self.sy = args['y']
        self.profile = ['pos']
        if 'size_w' in args and 'size_h' in args:
            self.shape = ShapeRect()
            self.shape.width = args['size_w']
            self.shape.height = args['size_h']
            self.profile.append('shape')
        if 'pressure' in args:
            self.pressure = args['pressure']
            self.profile.append('pressure')
        super(HIDMotionEvent, self).depack(args) 
開發者ID:BillBillBillBill,項目名稱:Tickeys-linux,代碼行數:16,代碼來源:hidinput.py

示例14: _draw_text

# 需要導入模塊: from kivy.core.window import Window [as 別名]
# 或者: from kivy.core.window.Window import height [as 別名]
def _draw_text(self):
        """
        Encompasses the drawing of a single textual block onto the card.
        """
        self.text_label = Label(
            text=self.text, font_size=self.font_size, markup=True
        )
        self.text_label.color = list(self.text_color)
        self.text_label.padding = 10, 10
        self.text_label.text_size = (Window.width, Window.height)
        self.text_label.valign = "middle"
        self.text_label.halign = "center"
        self.layout.add_widget(self.text_label) 
開發者ID:ntoll,項目名稱:pypercard,代碼行數:15,代碼來源:core.py

示例15: pct_h

# 需要導入模塊: from kivy.core.window import Window [as 別名]
# 或者: from kivy.core.window.Window import height [as 別名]
def pct_h(pct):
    return Window.height * pct 
開發者ID:autosportlabs,項目名稱:RaceCapture_App,代碼行數:4,代碼來源:utils.py


注:本文中的kivy.core.window.Window.height方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。