本文整理汇总了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)
示例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)
示例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()
示例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)
示例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)
示例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')
]
示例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
示例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))
示例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)
示例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
示例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]
示例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])
示例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)
示例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)
示例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