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


Python TK_ROOT.winfo_y方法代碼示例

本文整理匯總了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()
開發者ID:SpyyZ158,項目名稱:BEE2.4,代碼行數:50,代碼來源:contextWin.py

示例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()))
開發者ID:SpyyZ158,項目名稱:BEE2.4,代碼行數:8,代碼來源:contextWin.py


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