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


Python TK_ROOT.winfo_x方法代码示例

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


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

示例1: show_prop

# 需要导入模块: from tk_tools import TK_ROOT [as 别名]
# 或者: from tk_tools.TK_ROOT import winfo_x [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()
开发者ID:SpyyZ158,项目名称:BEE2.4,代码行数:50,代码来源:contextWin.py

示例2: follow_main

# 需要导入模块: from tk_tools import TK_ROOT [as 别名]
# 或者: from tk_tools.TK_ROOT import winfo_x [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()))
开发者ID:SpyyZ158,项目名称:BEE2.4,代码行数:8,代码来源:contextWin.py


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