本文整理汇总了Python中tk_tools.TK_ROOT.winfo_y方法的典型用法代码示例。如果您正苦于以下问题:Python TK_ROOT.winfo_y方法的具体用法?Python TK_ROOT.winfo_y怎么用?Python TK_ROOT.winfo_y使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tk_tools.TK_ROOT
的用法示例。
在下文中一共展示了TK_ROOT.winfo_y方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_prop
# 需要导入模块: from tk_tools import TK_ROOT [as 别名]
# 或者: from tk_tools.TK_ROOT import winfo_y [as 别名]
def show_prop(widget, warp_cursor=False):
"""Show the properties window for an item.
wid should be the UI.PalItem widget that represents the item.
If warp_cursor is true, the cursor will be moved relative to this window so
it stays on top of the selected subitem.
"""
global selected_item, selected_sub_item, is_open
if warp_cursor and is_open:
cursor_x, cursor_y = prop_window.winfo_pointerxy()
off_x = cursor_x-prop_window.winfo_rootx()
off_y = cursor_y-prop_window.winfo_rooty()
else:
off_x, off_y = None, None
prop_window.deiconify()
prop_window.lift(TK_ROOT)
selected_item = widget.item
selected_sub_item = widget
is_open = True
icon_widget = wid['subitem'][pos_for_item()]
# Calculate the pixel offset between the window and the subitem in
# the properties dialog, and shift if needed to keep it inside the
# window
loc_x, loc_y = utils.adjust_inside_screen(
x=(
widget.winfo_rootx()
+ prop_window.winfo_rootx()
- icon_widget.winfo_rootx()
),
y=(
widget.winfo_rooty()
+ prop_window.winfo_rooty()
- icon_widget.winfo_rooty()
),
win=prop_window,
)
prop_window.geometry('+{x!s}+{y!s}'.format(x=loc_x, y=loc_y))
prop_window.relX = loc_x-TK_ROOT.winfo_x()
prop_window.relY = loc_y-TK_ROOT.winfo_y()
if off_x is not None and off_y is not None:
# move the mouse cursor
prop_window.event_generate('<Motion>', warp=True, x=off_x, y=off_y)
load_item_data()
示例2: follow_main
# 需要导入模块: from tk_tools import TK_ROOT [as 别名]
# 或者: from tk_tools.TK_ROOT import winfo_y [as 别名]
def follow_main(_=None):
"""Move the properties window to keep a relative offset to the main window.
"""
prop_window.geometry('+'+str(prop_window.relX+TK_ROOT.winfo_x()) +
'+'+str(prop_window.relY+TK_ROOT.winfo_y()))