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


Python Window.become_target方法代码示例

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


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

示例1: open_pick_player_window

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import become_target [as 别名]

#.........这里部分代码省略.........
    # ========== Tool Button Declarations ==========
    attribute_btn = Button("Add Search Attribute")
    sort_btn = Button("Add Sort Attribute")
    reset_btn = Button("Reset Results")

    # ========== Action Button Functions ==========
    def start_btn_func():
        # Search - if no attribute selected, return all
        if len(attr_dict) == 0:
            search_results = db_dict[p_db_radio_group.value][1]
        else:
            search_results = db_dict[p_db_radio_group.value][1].search(attr_dict)
            search_results = PlayerDB.PlayerDB(search_results)

        # Sort - if no attribute selected, use rating
        if len(attr_list) == 0:
            search_results.sort(['rating'], sort_order_radio_group.value)
        else:
            search_results.sort(attr_list, sort_order_radio_group.value)

        # Get attributes list and avoid duplicates
        attributes_list = []

        for attr in attr_list:
            if attributes_list.count(attr) == 0:
                attributes_list.append(attr)

        for attr_key in attr_dict.iterkeys():
            if attributes_list.count(attr_key) == 0:
                attributes_list.append(attr_key)

        display_players(search_results, attributes_list, (0, num_results))

        win_pick_player.become_target()

    def back_btn_func():
        win_pick_player.hide()
        win_previous.show()

    # ========== Tool Button Functions ==========
    def attribute_btn_func():
        # Delete results
        del settings['messages']['results'][:]

        # Set type argument
        attr_type = 'player_search'

        # Open new window and close current window
        win_pick_player.hide()
        AddAttribute.open_attribute_window(win_pick_player.x, win_pick_player.y, db_dict,
                                           attr_dict, attr_list, attr_type, settings)

    def sort_btn_func():
        # Delete results
        del settings['messages']['results'][:]

        # Set type argument
        attr_type = 'player_sort'

        # Open new window and close current window
        win_pick_player.hide()
        AddAttribute.open_attribute_window(win_pick_player.x, win_pick_player.y, db_dict,
                                           attr_dict, attr_list, attr_type, settings)

    def reset_btn_func():
        # Remove messages off page
开发者ID:mcspen,项目名称:FIFA,代码行数:70,代码来源:PickPlayer.py


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