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


Python Window.resizable方法代码示例

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


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

示例1: open_search_menu

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import resizable [as 别名]
def open_search_menu(window_x, window_y, db_dict, attr_dict=None, attr_list=None, settings=None):

    num_results = 20
    general_display = []

    if attr_dict is None:
        attr_dict = {}

    if attr_list is None:
        attr_list = []

    if settings is None:
        settings = {
            "window": "search",
            "mode": "players",
            "p_db_rg": "player_db",
            "f_db_rg": "formation_db",
            "order_rg": True,
            "messages": {"search": [], "sort": [], "results": []},
        }

    # ========== Window ==========
    win_search = Window()
    win_search.title = search_win_title
    win_search.auto_position = False
    win_search.position = (window_x, window_y)
    win_search.size = (win_width, win_height)
    win_search.resizable = 0
    win_search.name = search_title + " Window"

    # ========== Window Image View ==========
    class FormationsWindowImageView(View):
        def draw(self, c, r):
            c.backcolor = view_backcolor
            c.erase_rect(r)

    view = FormationsWindowImageView(size=win_search.size)

    # ========== Title ==========
    title = Label(text=search_title)
    title.font = title_font
    title.width = title_width
    title.height = title_height
    title.x = (win_width - title_width) / 2
    title.y = top_border
    title.color = title_color
    title.just = "center"
    general_display.append(title)

    # ========== Action Button Declarations ==========
    start_btn = Button("Start")
    back_btn = Button("Back")

    # ========== Search Type Button Declarations ==========
    players_btn = Button("Players")
    formations_btn = Button("Formations")
    teams_btn = Button("Teams")

    search_type_button_list = [players_btn, formations_btn, teams_btn]

    # ========== 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():
        # Start button corresponds to players
        if settings["mode"] == "players":
            # 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))

        # Start button corresponds to formations
        elif settings["mode"] == "formations":
            # Search - if no attribute selected, return all
            if len(attr_dict) == 0:
                search_results = db_dict[f_db_radio_group.value][1]
#.........这里部分代码省略.........
开发者ID:mcspen,项目名称:FIFA,代码行数:103,代码来源:SearchMenu.py

示例2: open_pick_formation_window

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import resizable [as 别名]
def open_pick_formation_window(window_x, window_y, db_dict, win_previous):

    general_display = []

    # ========== Window ==========
    win_pick_formation = Window()
    win_pick_formation.title = pick_formation_win_title
    win_pick_formation.auto_position = False
    win_pick_formation.position = (window_x, window_y)
    win_pick_formation.size = (win_width, win_height)
    win_pick_formation.resizable = 0
    win_pick_formation.name = enter_text_title + " Window"
    win_pick_formation.show()

    # ========== Window Image View ==========
    class StartWindowImageView(View):
        def draw(self, c, r):
            c.backcolor = view_backcolor
            c.erase_rect(r)

    view = StartWindowImageView(size=win_pick_formation.size)

    # ========== Title ==========
    title = Label(text=pick_formation_title)
    title.font = title_font
    title.width = title_width
    title.height = title_height
    title.x = (win_pick_formation.width - title_width) / 2
    title.y = top_border
    title.color = title_color
    title.just = 'center'
    general_display.append(title)

    # ========== Button Functions ==========
    def formation_btn_func(formation):
        win_pick_formation.become_target()
        AssignPlayers.open_assign_players_window(win_pick_formation.x, win_pick_formation.y,
                                                 db_dict, formation, win_pick_formation)
        win_pick_formation.hide()

    def formation_list_btn_func():
        generic_formation = {"style": "Generic",
                             "name": "Generic",
                             "description": "Generic formation for picking players to be used with list of formations.",
                             "num_links": 17,
                             "num_defenders": 4,
                             "num_midfielders": 4,
                             "num_attackers": 2,
                             "positions": {
                                 "11": {"index": 0, "symbol": "11", "name": "Spot 11", "links": []},
                                 "10": {"index": 1, "symbol": "10", "name": "Spot 10", "links": []},
                                 "9": {"index": 2, "symbol": "9", "name": "Spot 9", "links": []},
                                 "8": {"index": 3, "symbol": "8", "name": "Spot 8", "links": []},
                                 "7": {"index": 4, "symbol": "7", "name": "Spot 7", "links": []},
                                 "6": {"index": 5, "symbol": "6", "name": "Spot 6", "links": []},
                                 "5": {"index": 6, "symbol": "5", "name": "Spot 5", "links": []},
                                 "4": {"index": 7, "symbol": "4", "name": "Spot 4", "links": []},
                                 "3": {"index": 8, "symbol": "3", "name": "Spot 3", "links": []},
                                 "2": {"index": 9, "symbol": "2", "name": "Spot 2", "links": []},
                                 "1": {"index": 10, "symbol": "1", "name": "Spot 1", "links": []}}}
        win_pick_formation.become_target()
        AssignPlayers.open_assign_players_window(win_pick_formation.x, win_pick_formation.y,
                                                 db_dict, generic_formation, win_pick_formation)
        win_pick_formation.hide()

    def back_btn_func():
        win_pick_formation.become_target()
        win_previous.show()
        win_pick_formation.hide()

    # ========== Formation Button Declarations ==========
    formation_button_width = 200
    msg_y = title.bottom

    # Sort DB so it is consistent
    db_dict['formation_db'][1].sort(['name'])

    for formation in db_dict['formation_db'][1].db:
        formation_btn = Button(title=formation['name'],
                                  font=std_tf_font,
                                  width=formation_button_width, height=std_tf_height,
                                  x=(win_pick_formation.width - formation_button_width)/2, y=msg_y,
                                  action=(formation_btn_func, formation))
        general_display.append(formation_btn)

        msg_y += std_tf_height + 1

    msg_y += 9

    formation_list_btn = Button(title='Use Formation List',
                                font=std_tf_font,
                                width=formation_button_width, height=std_tf_height,
                                x=(win_pick_formation.width - formation_button_width)/2, y=msg_y,
                                action=formation_list_btn_func)
    general_display.append(formation_list_btn)

    msg_y += std_tf_height + 10

    back_btn = Button('Back',
                      font=std_tf_font_bold,
#.........这里部分代码省略.........
开发者ID:mcspen,项目名称:FIFA,代码行数:103,代码来源:PickFormation.py

示例3: open_start_menu

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import resizable [as 别名]
def open_start_menu(window_x, window_y, db_dict):

    view_item_list = []

    # Load console type
    settings = {'console_type': ''}
    with open(config_filename, 'r') as f:
        settings["console_type"] = json.load(f)['console_type']
        f.close()

    # ========== Window ==========
    win_start = Window()
    win_start.title = start_win_title
    win_start.auto_position = False
    win_start.position = (window_x, window_y)
    win_start.size = (win_width, win_height)
    win_start.resizable = 0
    win_start.name = start_title + " Window"

    # ========== Window Image View ==========
    class StartWindowImageView(View):
        def draw(self, c, r):
            c.backcolor = view_backcolor
            c.erase_rect(r)
            image_pos = ((win_start.width - start_window_image.width)/2, search_btn.bottom + title_border)
            src_rect = start_window_image.bounds
            dst_rect = Geometry.offset_rect(src_rect, image_pos)
            start_window_image.draw(c, src_rect, dst_rect)

    view = StartWindowImageView(size=win_start.size)

    # ========== Start Window Image ==========
    start_window_image = Image(file='Images/start_menu_image.jpg')

    # ========== Title ==========
    title = Label(text=start_title)
    title.font = title_font
    title.width = title_width
    title.height = title_height
    title.x = (win_width - title_width) / 2
    title.y = top_border
    title.color = title_color
    title.just = 'center'
    view_item_list.append(title)

    # ========== Sort Order Radio Buttons ==========
    def save_console_type():
        """
        Save the console type
        """

        # Load configurations
        from AppConfig import config_filename
        with open(config_filename, 'r') as config_file:
            configurations = json.load(config_file)
            config_file.close()

        # Edit configurations
        configurations['console_type'] = settings["console_type"]

        # Save the settings
        with open(config_filename, 'w') as config_file:
            json.dump(configurations, config_file)
            config_file.close()

    def get_attribute_console_rg():
        settings["console_type"] = console_radio_group.value
        win_start.become_target()
        save_console_type()

    console_radio_group = RadioGroup(action=get_attribute_console_rg)

    console_radio_btn_width = 75
    console_label_width = 80
    radio_btn_space = 5

    console_rg_label = Label(text="Sort Order:", font=std_tf_font, width=console_label_width, height=std_tf_height,
                            color=title_color)
    console_rg_label.x = (win_start.width - 2 * console_radio_btn_width - radio_btn_space - console_label_width) / 2
    console_rg_label.y = title.bottom + radio_btn_space
    view_item_list.append(console_rg_label)

    playstation_radio_btn = RadioButton("PlayStation")
    playstation_radio_btn.width = console_radio_btn_width
    playstation_radio_btn.x = console_rg_label.right
    playstation_radio_btn.y = console_rg_label.top
    playstation_radio_btn.group = console_radio_group
    playstation_radio_btn.value = 'PLAYSTATION'
    view_item_list.append(playstation_radio_btn)

    xbox_radio_btn = RadioButton("Xbox")
    xbox_radio_btn.width = console_radio_btn_width
    xbox_radio_btn.x = playstation_radio_btn.right + radio_btn_space
    xbox_radio_btn.y = playstation_radio_btn.top
    xbox_radio_btn.group = console_radio_group
    xbox_radio_btn.value = 'XBOX'
    view_item_list.append(xbox_radio_btn)

    if settings["console_type"] in ['PLAYSTATION', 'XBOX']:
        console_radio_group.value = settings["console_type"]
#.........这里部分代码省略.........
开发者ID:mcspen,项目名称:FIFA,代码行数:103,代码来源:StartMenu.py

示例4: open_enter_text_window

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import resizable [as 别名]
def open_enter_text_window(window_x, window_y, db_dict, settings, box_type, fill_text='', file_prefix=''):

    general_display = []

    if box_type == 'rename':
        title = 'Rename File'
        old_file_name = fill_text
        message_text = 'Enter new file name.'
    elif box_type == 'duplicate':
        title = 'Duplicate File'
        old_file_name = fill_text
        message_text = 'Enter new file name.'
    elif box_type == 'download':
        title = 'Download Player Database'
        message_text = 'Enter player database name.'
        download_settings = {'overwrite_counter': 0, 'last_entered_text': ''}
    else:
        title = 'Enter Text'
        message_text = 'Enter text.'

    # ========== Window ==========
    win_enter_text = Window()
    win_enter_text.title = title
    win_enter_text.auto_position = False
    win_enter_text.position = (window_x+100, window_y+100)
    win_enter_text.size = (win_width-200, win_height-400)
    win_enter_text.resizable = 0
    win_enter_text.name = enter_text_title + " Window"
    win_enter_text.show()

    # ========== Window Image View ==========
    class StartWindowImageView(View):
        def draw(self, c, r):
            c.backcolor = view_backcolor
            c.erase_rect(r)

    view = StartWindowImageView(size=win_enter_text.size)

    # ========== Title ==========
    title = Label(text=title)
    title.font = title_font
    title.width = title_width
    title.height = title_height
    title.x = (win_enter_text.width - title_width) / 2
    title.y = top_border
    title.color = title_color
    title.just = 'center'
    general_display.append(title)

    # ========== Message Label ==========
    message = Label(font=title_font_2, width=win_enter_text.width - 50, height=title_height,
                    x=25, y=title.bottom + top_border, color=title_color, just='center')
    message.text = message_text
    general_display.append(message)

    # ========== Button Declarations ==========
    enter_btn = Button("Enter")
    back_btn = Button("Back")

    # ========== Button Functions ==========
    def enter_btn_func():
        # Rename file
        if box_type == 'rename':

            # Get new name
            new_file_name = value_tf.value

            if len(new_file_name) > 0:

                if not isfile('JSONs/' + file_prefix + new_file_name + '.json'):
                    # Rename file
                    rename('JSONs/' + file_prefix + old_file_name + '.json',
                           'JSONs/' + file_prefix + new_file_name + '.json')

                    # Disable pick file back button in case the selected file has changed
                    settings['file_changes'] = True

                    PickFile.open_pick_file_window(window_x, window_y, db_dict, settings)
                    win_enter_text.hide()

                else:
                    message.text = "A file with that name already exists."

            else:
                message.text = "File name must be at least 1 character."

        # Duplicate file
        elif box_type == 'duplicate':

            # Get new name
            duplicate_file_name = value_tf.value

            if len(duplicate_file_name) > 0:

                if not isfile('JSONs/' + file_prefix + duplicate_file_name + '.json'):
                    # Create duplicate file
                    copyfile('JSONs/' + file_prefix + old_file_name + '.json',
                             'JSONs/' + file_prefix + duplicate_file_name + '.json')

                    PickFile.open_pick_file_window(window_x, window_y, db_dict, settings)
#.........这里部分代码省略.........
开发者ID:mcspen,项目名称:FIFA,代码行数:103,代码来源:EnterText.py

示例5: open_player_bio_window

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import resizable [as 别名]
def open_player_bio_window(window_x, window_y, player, win_previous, db_dict=None, file_name=None, current_list=None,
                           roster=None, pos_symbol=None, input_formation=None, pick_formations_page=None):

    if current_list is None:
        current_list = PlayerDB.PlayerDB()

    # ========== Window ==========
    win_player_bio = Window()
    win_player_bio.title = player_bio_win_title
    win_player_bio.auto_position = False
    win_player_bio.position = (window_x, window_y)
    win_player_bio.size = (win_width, win_height)
    win_player_bio.resizable = 0
    win_player_bio.name = player_bio_title + " Window"
    win_player_bio.show()

    # ========== Window Image View ==========
    class PlayerBioWindowImageView(View):
        def draw(self, c, r):
            c.backcolor = view_backcolor
            c.erase_rect(r)

            # Background image
            image_pos = ((player_name_label.left - player_background.width)/2, 5)
            src_rect = player_background.bounds
            dst_rect = Geometry.offset_rect(src_rect, image_pos)
            player_background.draw(c, src_rect, dst_rect)

            # Lines between summary stats
            c.forecolor = stat_line_color
            c.fill_rect((dst_rect[0]+22, dst_rect[1]+stat_line_y,
                         dst_rect[2]-22, dst_rect[1]+stat_line_y+1))
            c.fill_rect((dst_rect[0]+22, dst_rect[1]+stat_line_y+stat_line_spacing,
                         dst_rect[2]-22, dst_rect[1]+stat_line_y+stat_line_spacing+1))

            # Headshot
            image_pos = (image_pos[0]+player_headshot_pos[0], player_headshot_pos[1])
            src_rect = player_headshot.bounds
            headshot_dst_rect = Geometry.offset_rect(src_rect, image_pos)
            player_headshot.draw(c, src_rect, headshot_dst_rect)

            # Club
            if 'normal' in player['club']['imageUrls']:
                image_url = player['club']['imageUrls']['normal']['large']
            # FIFA 15 compatibility
            elif 'dark' in player['club']['imageUrls']:
                image_url = player['club']['imageUrls']['dark']['large']
            ratio = 0.75
            image_file_name = 'club_' + str(player['club']['id']) + '_' + str(ratio)
            image_file_name = save_small_image(image_url, image_file_name, ratio)
            club_image = Image(file=image_file_name)
            club_image_pos = club_pos
            club_rect = club_image.bounds
            club_dst_rect = Geometry.offset_rect(club_rect, club_image_pos)
            club_image.draw(c, club_rect, club_dst_rect)

            # Nation
            if 'imageUrls' in player['nation']:
                image_url = player['nation']['imageUrls']['large']
            # FIFA 15 compatibility
            elif 'imageUrl' in player['nation']:
                image_url = player['nation']['imgUrl']
            ratio = 0.75
            image_file_name = 'nation_' + str(player['nation']['id']) + '_' + str(ratio)
            image_file_name = save_small_image(image_url, image_file_name, ratio)
            nation_image = Image(file=image_file_name)
            nation_image_pos = (club_image_pos[0], club_image_pos[1]+club_image.size[1]+nation_spacing)
            nation_rect = nation_image.bounds
            nation_dst_rect = Geometry.offset_rect(nation_rect, nation_image_pos)
            nation_image.draw(c, nation_rect, nation_dst_rect)

            # Coins symbol
            image_file_name = 'Images/coins.png'
            coins_image = Image(file=image_file_name)
            coins_image_pos = coins_pos
            coins_rect = coins_image.bounds
            coins_dst_rect = Geometry.offset_rect(coins_rect, coins_image_pos)
            coins_image.draw(c, coins_rect, coins_dst_rect)

    view = PlayerBioWindowImageView(size=win_player_bio.size)

    # ========== Player Headshot ==========
    image_url = player['headshotImgUrl']
    image_file_name = player['id'] + '_full'
    # FIFA 15 compatibility
    if "130x130" in image_url:
        ratio = 120.0/130.0
        image_file_name = save_small_image(image_url, image_file_name, ratio)
    elif "120x120" in image_url:
        image_file_name = save_image(image_url, image_file_name)
    player_headshot = Image(file=image_file_name)

    # ========== Player Background ==========
    # Assign player background card
    if player['color'] in ['award_winner', 'bronze', 'confederation_champions_motm', 'easports', 'fut_champions_bronze',
                           'fut_champions_gold', 'fut_champions_silver', 'gold', 'green', 'halloween', 'legend', 'motm',
                           'motm_2', 'movember', 'ones_to_watch', 'pink_gold', 'pink', 'purple', 'rare_bronze',
                           'rare_gold', 'rare_silver', 'red_blue', 'silver', 'sbc_base', 'squad_building_challenge',
                           'teal', 'tott', 'tots_bronze', 'tots_gold', 'tots_silver', 'totw_bronze', 'totw_gold',
                           'totw_silver', 'toty']:
#.........这里部分代码省略.........
开发者ID:mcspen,项目名称:FIFA,代码行数:103,代码来源:PlayerBio.py

示例6: open_attribute_window

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import resizable [as 别名]
def open_attribute_window(window_x, window_y, db_dict, attr_dict, attr_list, attr_type, settings):

    # ========== Window ==========
    win_attribute = Window()
    win_attribute.title = attribute_win_title
    win_attribute.auto_position = False
    win_attribute.position = (window_x, window_y)
    win_attribute.size = (win_width, 500)
    win_attribute.resizable = 0
    win_attribute.name = attribute_title + " Window"
    win_attribute.show()

    # ========== Window Image View ==========
    class AddAttributeWindowImageView(View):
        def draw(self, c, r):
            c.backcolor = view_backcolor
            c.erase_rect(r)

    view = AddAttributeWindowImageView(size=win_attribute.size)

    attribute_display_list = []

    # ========== Title ==========
    title = Label(text=attribute_title)
    title.font = title_font
    title.width = title_width
    title.height = title_height
    title.x = (win_width - title_width) / 2
    title.y = top_border
    title.color = title_color
    title.just = 'center'
    view.add(title)

    # ========== Button Declarations ==========
    enter_btn = Button("Enter")
    erase_btn = Button("Erase List")
    back_btn = Button("Back")

    # ========== Radio Button Action ==========
    def selection_made():
        enter_btn.enabled = 1
        win_attribute.become_target()

    def comp_selection_made():
        win_attribute.become_target()

    def attribute_button_func(attr_value):
        # Check for doubles
        if attr_list.count(attr_value) == 0:
            attr_list.append(attr_value)

        show_attributes(attribute_display_list)
        erase_btn.enabled = 1
        win_attribute.become_target()

    # ========== Attribute Radio Buttons ==========
    radio_group = RadioGroup(action=selection_made)
    radio_button_list = []
    buttons_per_column = 11

    config_file = '_attributes'
    if attr_type[:4] == 'play':
        config_file = 'player' + config_file
    elif attr_type[:4] == 'form':
        config_file = 'formation' + config_file
    elif attr_type[:4] == 'team':
        config_file = 'team' + config_file
    else:
        print "Invalid attribute type."

    with open(config_filename, 'r') as f:
            attributes_list = json.load(f)[config_file]['all']
            f.close()

    for idx, attribute in enumerate(attributes_list):
        if attr_type[-6:] == 'search':
            button = RadioButton(attribute)
            button.group = radio_group
            button.value = attribute
            button.title = format_attr_name(attribute)
        elif attr_type[-4:] == 'sort':
            button = Button()
            button.action = (attribute_button_func, attribute)
            button.title = format_attr_name(attribute)
        else:
            print "Invalid attribute type."

        if attr_type[:4] == 'play':
            if idx < buttons_per_column:
                button.width = 45
                button.x = (idx / buttons_per_column) * (button.width + 5) + 5
            elif idx < 3*buttons_per_column:
                button.width = 100
                button.x = (idx / buttons_per_column) * (button.width + 5) - 50
            elif idx < 4*buttons_per_column:
                button.width = 110
                button.x = (idx / buttons_per_column) * (button.width + 5) - 80
            else:
                button.width = 100
                button.x = (idx / buttons_per_column) * (button.width + 5) - 40
#.........这里部分代码省略.........
开发者ID:mcspen,项目名称:FIFA,代码行数:103,代码来源:AddAttribute.py

示例7: open_pick_player_window

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import resizable [as 别名]
def open_pick_player_window(window_x, window_y, db_dict, input_formation, win_previous, roster, pos_symbol,
                            pick_formations_page, attr_dict=None, attr_list=None, settings=None):

    num_results = 20
    general_display = []

    if attr_dict is None:
        attr_dict = {}

    if attr_list is None:
        attr_list = []

    if settings is None:
        settings = {
            'window': 'pick_player',
            'p_db_rg': 'player_list',
            'pos_search_rg': 'green',
            'order_rg': True,
            'messages': {
                'search': [],
                'sort': [],
                'results': []
            },
            'input_formation': input_formation,
            'roster': roster,
            'pos_symbol': pos_symbol,
            'win_previous': win_previous,
            'pick_formations_page': pick_formations_page}

        # Assign exact position as default position to search for.
        attr_dict['position'] = (input_formation['positions'][pos_symbol]['symbol'], 'exact')

        # Not position dependent - search all.
        if input_formation['name'] == 'Generic':
            settings['pos_search_rg'] = 'red'
            attr_dict.pop('position', None)

    # ========== Window ==========
    win_pick_player = Window()
    win_pick_player.title = pick_player_win_title + ' - ' + pos_symbol
    win_pick_player.auto_position = False
    win_pick_player.position = (window_x, window_y)
    win_pick_player.size = (win_width, win_height)
    win_pick_player.resizable = 0
    win_pick_player.name = pick_player_title + " Window"

    # ========== Window Image View ==========
    class PickPlayerWindowImageView(View):
        def draw(self, c, r):
            c.backcolor = view_backcolor
            c.erase_rect(r)

    view = PickPlayerWindowImageView(size=win_pick_player.size)

    # ========== Title ==========
    title = Label(text=pick_player_title + ' - ' + pos_symbol)
    title.font = title_font
    title.width = title_width
    title.height = title_height
    title.x = (win_width - title_width) / 2
    title.y = top_border
    title.color = title_color
    title.just = 'center'
    general_display.append(title)

    # ========== Action Button Declarations ==========
    start_btn = Button("Start")
    back_btn = Button("Back")

    # ========== 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)

#.........这里部分代码省略.........
开发者ID:mcspen,项目名称:FIFA,代码行数:103,代码来源:PickPlayer.py

示例8: open_confirm_prompt_window

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import resizable [as 别名]
def open_confirm_prompt_window(window_x, window_y, db_dict, settings, file_path, file_name):

    # ========== Window ==========
    win_confirm_prompt = Window()
    win_confirm_prompt.title = confirm_prompt_win_title
    win_confirm_prompt.auto_position = False
    win_confirm_prompt.position = (window_x+100, window_y+100)
    win_confirm_prompt.size = (win_width-200, win_height-400)
    win_confirm_prompt.resizable = 0
    win_confirm_prompt.name = confirm_prompt_title + " Window"
    win_confirm_prompt.show()

    # ========== Window Image View ==========
    class StartWindowImageView(View):
        def draw(self, c, r):
            c.backcolor = view_backcolor
            c.erase_rect(r)

    view = StartWindowImageView(size=win_confirm_prompt.size)

    # ========== Title ==========
    title = Label(text=confirm_prompt_title)
    title.font = title_font
    title.width = title_width
    title.height = title_height
    title.x = (win_confirm_prompt.width - title_width) / 2
    title.y = top_border
    title.color = title_color
    title.just = 'center'

    # ========== Message Label ==========
    message = Label(font=title_font_2, width=win_confirm_prompt.width - 50, height=title_height,
                    x=25, y=title.bottom + top_border, color=title_color, just='center')
    message.text = "Delete \"%s\"?" % file_name

    # ========== Button Declarations ==========
    yes_btn = Button("Yes")
    cancel_btn = Button("Cancel")

    # ========== Button Functions ==========
    def yes_btn_func():

        # Disable back button in case the selected file has changed
        settings['file_changes'] = True

        # Delete file
        try:
            remove(file_path)

        except Exception as err:
            message.text = "Error: " + err.args[1]

        PickFile.open_pick_file_window(window_x, window_y, db_dict, settings)
        win_confirm_prompt.hide()

    def cancel_btn_func():
        PickFile.open_pick_file_window(window_x, window_y, db_dict, settings)
        win_confirm_prompt.hide()

    # ========== Buttons ==========
    yes_btn.x = (win_confirm_prompt.width - 2*button_width - button_spacing) / 2
    yes_btn.y = win_confirm_prompt.height - 70
    yes_btn.height = button_height
    yes_btn.width = button_width
    yes_btn.font = button_font
    yes_btn.action = yes_btn_func
    yes_btn.style = 'default'
    yes_btn.color = button_color
    yes_btn.just = 'right'

    cancel_btn.x = yes_btn.right + button_spacing
    cancel_btn.y = yes_btn.top
    cancel_btn.height = button_height
    cancel_btn.width = button_width
    cancel_btn.font = button_font
    cancel_btn.action = cancel_btn_func
    cancel_btn.style = 'default'
    cancel_btn.color = button_color
    cancel_btn.just = 'right'

    # ========== Add buttons to window ==========
    view.add(title)
    view.add(message)
    view.add(yes_btn)
    view.add(cancel_btn)

    win_confirm_prompt.add(view)
    view.become_target()
    win_confirm_prompt.show()
开发者ID:mcspen,项目名称:FIFA,代码行数:91,代码来源:ConfirmPrompt.py

示例9: open_pick_file_window

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import resizable [as 别名]
def open_pick_file_window(window_x, window_y, db_dict, settings):

    # ========== Window ==========
    win_pick_file = Window()
    win_pick_file.title = pick_file_win_title
    win_pick_file.auto_position = False
    win_pick_file.position = (window_x, window_y)
    win_pick_file.size = (win_width, win_height)
    win_pick_file.resizable = 0
    win_pick_file.name = pick_file_title + " Window"
    win_pick_file.show()

    # ========== Window Image View ==========
    class StartWindowImageView(View):
        def draw(self, c, r):
            c.backcolor = view_backcolor
            c.erase_rect(r)

    view = StartWindowImageView(size=win_pick_file.size)

    display_list = []

    file_type = settings['file_type']

    # ========== Title ==========
    title = Label(text=pick_file_title)
    title.font = title_font
    title.width = title_width
    title.height = title_height
    title.x = (win_width - title_width) / 2
    title.y = top_border
    title.color = title_color
    title.just = 'center'
    display_list.append(title)

    # ========== Sub Title ==========
    def get_sub_title_text():
        if file_type == 'default_player_db':
            text = "default player database"
        elif file_type == 'default_player_list':
            text = "default player list"
        elif file_type == 'default_formation_db':
            text = "default formation database"
        elif file_type == 'default_formation_list':
            text = "default formation list"
        elif file_type == 'default_team_list':
            text = "default team list"
        elif file_type == 'current_player_db':
            text = "current player database"
        elif file_type == 'current_player_list':
            text = "current player list"
        elif file_type == 'current_formation_db':
            text = "current formation database"
        elif file_type == 'current_formation_list':
            text = "current formation list"
        elif file_type == 'current_team_list':
            text = "current team list"
        else:
            text = "a"
        return text

    sub_title = Label(font=title_font_2, width=title_width, height=title_height,
                      x=(win_pick_file.width-title_width)/2, y=title.bottom, color=title_color, just='center')
    sub_title_text = get_sub_title_text()
    sub_title.text = "Select %s file:" % sub_title_text
    display_list.append(sub_title)

    # ========== Display Files ==========
    def display_files():
        file_prefix = HelperFunctions.get_file_prefix(file_type)

        # Get corresponding file names
        all_files = listdir('JSONs/')
        file_list = []
        # Truncate file paths to just the names
        for filename in all_files:
            if filename[:8] == file_prefix:
                filename = filename[8:]
                filename = filename[:-5]
                file_list.append(filename)

        # Button Functions
        def select_file_func(file_name):

            # Save new default to config file
            if file_type[:7] == 'default':
                # Load configs
                from Window.AppConfig import config_filename
                configs = {}
                with open(config_filename, 'r') as config_file:
                    configs = json.load(config_file)
                    config_file.close()

                # Assign new file name to config
                configs['default_databases'][file_type[8:]] = file_name

                # Save configs
                with open(config_file, 'w') as config_file:
                    json.dump(configs, config_file)
                    config_file.close()
#.........这里部分代码省略.........
开发者ID:mcspen,项目名称:FIFA,代码行数:103,代码来源:PickFile.py

示例10: open_files_menu

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import resizable [as 别名]
def open_files_menu(window_x, window_y, db_dict, settings=None):

    general_display_list = []
    lists_display_list = []
    databases_display_list = []
    defaults_display_list = []

    with open(config_filename, 'r') as f:
        default_databases = json.load(f)['default_databases']
        f.close()

    if settings is None:
        settings = {
            'mode': 'lists',
            'file_changes': False
        }

    # ========== Window ==========
    win_files = Window()
    win_files.title = files_win_title
    win_files.auto_position = False
    win_files.position = (window_x, window_y)
    win_files.size = (win_width, win_height)
    win_files.resizable = 0
    win_files.name = "Files Window"

    # ========== Window Image View ==========
    class FormationsWindowImageView(View):
        def draw(self, c, r):
            c.backcolor = view_backcolor
            c.erase_rect(r)

    view = FormationsWindowImageView(size=win_files.size)

    # ========== Title ==========
    title = Label(text=files_title)
    title.font = title_font
    title.width = title_width
    title.height = title_height
    title.x = (win_files.width - title_width) / 2
    title.y = top_border
    title.color = title_color
    title.just = 'center'
    general_display_list.append(title)

    # Subtitle
    subtitle = Label(font=title_font_2, width=title_width, height=title_height,
                     x=(win_files.width - title_width) / 2,
                     color=title_color, just = 'center')
    general_display_list.append(subtitle)

    # ========== Helper Functions ==========
    def remove_old_display():
        """
        Remove previous displayed items
        """
        if settings['mode'] == 'lists':
            for display_item in lists_display_list:
                view.remove(display_item)
        elif settings['mode'] == 'databases':
            for display_item in databases_display_list:
                view.remove(display_item)
        elif settings['mode'] == 'defaults':
            for display_item in defaults_display_list:
                view.remove(display_item)
        else:
            print "Settings mode is invalid."

    def add_new_display():
        """
        Remove previous displayed items
        """
        if settings['mode'] == 'lists':
            subtitle.text = "Current Lists"
            for display_item in lists_display_list:
                view.add(display_item)
        elif settings['mode'] == 'databases':
            subtitle.text = "Current Databases"
            for display_item in databases_display_list:
                view.add(display_item)
        elif settings['mode'] == 'defaults':
            subtitle.text = "Default Files"
            for display_item in defaults_display_list:
                view.add(display_item)
        else:
            print "Settings mode is invalid."

    # ========== Button Toolbar Functions ==========
    def lists_btn_func():
        # Remove previous displayed items
        remove_old_display()

        settings['mode'] = 'lists'

        # Add new display items
        add_new_display()

        for btn in button_list:
            btn.enabled = 1
        lists_btn.enabled = 0
#.........这里部分代码省略.........
开发者ID:mcspen,项目名称:FIFA,代码行数:103,代码来源:FilesMenu.py

示例11: open_formation_bio_window

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import resizable [as 别名]
def open_formation_bio_window(window_x, window_y, formation, win_previous, file_name, current_list):

    # ========== Window ==========
    win_formation_bio = Window()
    win_formation_bio.title = formation_bio_win_title
    win_formation_bio.auto_position = False
    win_formation_bio.position = (window_x, window_y)
    win_formation_bio.size = (win_width, win_height)
    win_formation_bio.resizable = 0
    win_formation_bio.name = formation_bio_title + " Window"
    win_formation_bio.show()

    # ========== Load Formation Spacing ==========
    # Get attribute lists
    with open(config_filename, 'r') as f:
        formation_spacing = json.load(f)['formation_coordinates'][formation['name']]
        f.close()

    labels_list = []

    # ========== Field Ratio ==========
    y_to_x_ratio = 0.8

    # Line specification
    line_color = white
    line_size = 2

    # Field
    field_color = dark_green
    field_length = 600
    field_width = field_length*y_to_x_ratio

    # Field positioning on screen
    field_x_offset = (win_formation_bio.width - field_width - button_width - 100) / 2
    field_y_offset = top_border + title_height + title_border

    # Center circle
    center_spot_x = field_x_offset + field_width/2
    center_spot_y = field_y_offset + field_length/2
    circle_radius = int(field_length/10)

    # Goal box
    penalty_spot_height = int(field_length*12/100)
    eighteen_box_height = int(field_length*18/100)
    eighteen_box_width = int(field_length*44/100)
    six_box_height = int(field_length*6/100)
    six_box_width = int(field_length*20/100)

    # Corner semi circles
    corner_semi_circle_radius = int(field_length*2/100)

    # ========== Player Spacing Values ==========
    x_space = int(field_width/20)
    y_space = int(field_length/24)
    player_box_width = 80
    player_box_height = 50
    player_box_color = lighter
    link_size = 5
    link_color = red

    # ========== Window Image View ==========
    image_pos = (field_x_offset, field_y_offset)
    src_rect = (0, 0, field_width, field_length)
    dst_rect = Geometry.offset_rect(src_rect, image_pos)

    class StartWindowImageView(View):
        def draw(self, c, r):
            c.backcolor = view_backcolor
            c.erase_rect(r)

            # Field and sidelines
            c.forecolor = field_color
            c.fill_rect((dst_rect[0]-5, dst_rect[1]-5, dst_rect[2]+5, dst_rect[3]+5))
            c.forecolor = line_color
            c.fill_rect((dst_rect[0], dst_rect[1], dst_rect[2], dst_rect[3]))
            c.forecolor = field_color
            c.fill_rect((dst_rect[0]+line_size, dst_rect[1]+line_size, dst_rect[2]-line_size, dst_rect[3]-line_size))

            # Center circle, center spot, and half-way line
            c.forecolor = line_color
            c.fill_oval((center_spot_x-circle_radius, center_spot_y-circle_radius,
                         center_spot_x+circle_radius, center_spot_y+circle_radius))
            c.forecolor = field_color
            c.fill_oval((center_spot_x-circle_radius+line_size, center_spot_y-circle_radius+line_size,
                         center_spot_x+circle_radius-line_size, center_spot_y+circle_radius-line_size))
            c.forecolor = line_color
            c.fill_rect((dst_rect[0], center_spot_y-line_size/2, dst_rect[2], center_spot_y+line_size/2))
            c.fill_oval((center_spot_x-line_size*2, center_spot_y-line_size*2,
                         center_spot_x+line_size*2, center_spot_y+line_size*2))

            # Goal box semi circle
            c.forecolor = line_color
            c.fill_oval((center_spot_x-circle_radius, dst_rect[1]+penalty_spot_height-circle_radius,
                         center_spot_x+circle_radius, dst_rect[1]+penalty_spot_height+circle_radius))
            c.fill_oval((center_spot_x-circle_radius, dst_rect[3]-penalty_spot_height-circle_radius,
                         center_spot_x+circle_radius, dst_rect[3]-penalty_spot_height+circle_radius))
            c.forecolor = field_color
            c.fill_oval((center_spot_x-circle_radius+line_size,
                         dst_rect[1]+penalty_spot_height-circle_radius+line_size,
                         center_spot_x+circle_radius-line_size,
#.........这里部分代码省略.........
开发者ID:mcspen,项目名称:FIFA,代码行数:103,代码来源:FormationBio.py

示例12: open_attribute_window

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import resizable [as 别名]
def open_attribute_window(window_x, window_y, db_dict, attr_dict, attr_list, attr_type, settings):

    # ========== Window ==========
    win_attribute = Window()
    win_attribute.title = attribute_win_title
    win_attribute.auto_position = False
    win_attribute.position = (window_x, window_y)
    win_attribute.size = (win_width, 500)
    win_attribute.resizable = 0
    win_attribute.name = attribute_title + " Window"
    win_attribute.show()

    # ========== Window Image View ==========
    class StartWindowImageView(View):
        def draw(self, c, r):
            c.backcolor = view_backcolor
            c.erase_rect(r)

    view = StartWindowImageView(size=win_attribute.size)

    attribute_display_list = []

    # ========== Title ==========
    title = Label(text=attribute_title)
    title.font = title_font
    title.width = title_width
    title.height = title_height
    title.x = (win_width - title_width) / 2
    title.y = top_border
    title.color = title_color
    title.just = 'center'

    # ========== Button Declarations ==========
    enter_btn = Button("Enter")
    erase_btn = Button("Erase List")
    back_btn = Button("Back")

    # ========== Radio Button Action ==========
    def selection_made():
        enter_btn.enabled = 1
        win_attribute.become_target()

    def comp_selection_made():
        win_attribute.become_target()

    # ========== Attribute Radio Buttons ==========
    radio_group = RadioGroup(action=selection_made)
    radio_button_list = []

    with open(config_filename, 'r') as f:
            attributes_list = json.load(f)['player_attributes']['all']
            f.close()

    for idx, attribute in enumerate(attributes_list):
        button = RadioButton(attribute)

        if idx < 10:
            button.width = 45
            button.x = (idx / 10) * (button.width + 5) + 5
        elif idx < 30:
            button.width = 100
            button.x = (idx / 10) * (button.width + 5) - 50
        elif idx < 40:
            button.width = 110
            button.x = (idx / 10) * (button.width + 5) - 80
        else:
            button.width = 100
            button.x = (idx / 10) * (button.width + 5) - 40

        button.y = (idx % 10) * 25 + title.bottom + 5
        button.group = radio_group
        button.value = attribute
        button.title = format_attr_name(attribute)

        radio_button_list.append(button)

    # ========== Button Functions ==========
    def enter_btn_func():
        valid = False
        return_value = None

        if attr_type == 'sort':
            # Check for doubles
            if attr_list.count(radio_group.value) == 0:
                attr_list.append(radio_group.value)

            show_attributes(attribute_display_list)
            erase_btn.enabled = 1

        elif attr_type == 'search':
            # Value checks
            if radio_group.value in ["PAC", "SHO", "PAS", "DRI", "DEF", "PHY", "DIV", "HAN", "KIC", "REF", "SPD", "POS",
                                     "acceleration", "aggression", "agility", "balance", "ballcontrol", "crossing",
                                     "curve", "dribbling", "finishing", "freekickaccuracy", "gkdiving", "gkhandling",
                                     "gkkicking", "gkpositioning", "gkreflexes", "headingaccuracy", "interceptions",
                                     "jumping", "longpassing", "longshots", "marking", "penalties", "positioning",
                                     "potential", "rating", "reactions", "shortpassing", "shotpower", "skillMoves",
                                     "slidingtackle", "sprintspeed", "stamina", "standingtackle", "strength", "vision",
                                     "volleys", "weakFoot"]:
                # Value should be an integer between 0 and 100
#.........这里部分代码省略.........
开发者ID:mcspen,项目名称:FIFA,代码行数:103,代码来源:TextBox.py

示例13: open_pick_position_window

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import resizable [as 别名]
def open_pick_position_window(window_x, window_y, player, player_db, settings, btn, previous_window):

    # ========== Window ==========
    win_position = Window()
    win_position.title = pick_position_win_title
    win_position.auto_position = False
    win_position.position = (window_x, window_y)
    win_position.size = (win_width, 500)
    win_position.resizable = 0
    win_position.name = pick_position_title + " Window"
    win_position.show()

    # ========== Window Image View ==========
    class StartWindowImageView(View):
        def draw(self, c, r):
            c.backcolor = view_backcolor
            c.erase_rect(r)

    view = StartWindowImageView(size=win_position.size)

    display_list = []

    # ========== Title ==========
    title = Label(text=pick_position_title)
    title.font = title_font
    title.width = title_width
    title.height = title_height
    title.x = (win_width - title_width) / 2
    title.y = top_border
    title.color = title_color
    title.just = 'center'
    display_list.append(title)

    # ========== Button Function ==========
    def pos_btn_func(position_short, position_full):
        # Edit player's position
        player_data = player_db.search({'id': (player['id'], 'exact')})
        player_index = player_db.db.index(player_data[0])
        player_db.db[player_index]['position'] = position_short
        player_db.db[player_index]['positionFull'] = position_full

        # Save
        player_db.save(settings['file_name'], 'list', True)

        # Change button symbol
        btn.title = position_short
        win_position.hide()
        previous_window.show()

    def back_btn_func():
        # Go back
        win_position.hide()
        previous_window.show()

    # ========== Position Buttons ==========
    msg_x = (win_position.width - 5*button_width - 4*button_spacing) / 2
    msg_y = title.bottom + title_border
    positions = [
        ('LW', 'Left Wing'), ('LF', 'Left Forward'), ('ST', 'Striker'), ('RF', 'Right Forward'), ('RW', 'Right Wing'),
        ('CF', 'Centre Forward'),
        ('CAM', 'Centre Attacking Midfielder'),
        ('LM', 'Left Midfielder'), ('CM', 'Centre Midfielder'), ('RM', 'Right Midfielder'),
        ('CDM', 'Centre Defensive Midfielder'),
        ('LWB', 'Left Wing Back'), ('LB', 'Left Back'), ('CB', 'Centre Back'), ('RB', 'Right Back'),
        ('RWB', 'Right Wing Back'),
        ('GK', 'Goalkeeper')]

    for index, pos in enumerate(positions):
        if pos[0] in ['CAM', 'CDM']:
            width = button_width + 65
        else:
            width = button_width

        if index == 5:
            msg_x = (win_position.width - width) / 2
            msg_y += small_button_height + button_spacing
        elif index == 6:
            msg_x = (win_position.width - width) / 2
            msg_y += small_button_height + button_spacing
        elif index == 7:
            msg_x = (win_position.width - 3*width - 2*button_spacing) / 2
            msg_y += small_button_height + button_spacing
        elif index == 10:
            msg_x = (win_position.width - width) / 2
            msg_y += small_button_height + button_spacing
        elif index == 11:
            msg_x = (win_position.width - 5*width - 4*button_spacing) / 2
            msg_y += small_button_height + button_spacing
        elif index == 16:
            msg_x = (win_position.width - width) / 2
            msg_y += small_button_height + button_spacing

        position_title = pos[0] + ' - ' + pos[1]
        pos_btn = Button(title=position_title, width=width, height=small_button_height, x=msg_x, y=msg_y,
                         action=(pos_btn_func, pos[0], pos[1]), font=smaller_tf_font)
        display_list.append(pos_btn)

        msg_x += width + button_spacing

    # ========== Back Button ==========
#.........这里部分代码省略.........
开发者ID:mcspen,项目名称:FIFA,代码行数:103,代码来源:PickPosition.py

示例14: open_create_list_window

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import resizable [as 别名]
def open_create_list_window(window_x, window_y, db_dict, settings):

    message_text = 'Select list type.'
    create_list_settings = dict()
    create_list_settings['results'] = []
    create_list_settings['process_step'] = 'list type'
    num_results = 5

    # ========== Window ==========
    win_create_list = Window()
    win_create_list.title = create_list_win_title
    win_create_list.auto_position = False
    win_create_list.position = (window_x+100, window_y+100)
    win_create_list.size = (win_width-100, win_height-200)
    win_create_list.resizable = 0
    win_create_list.name = create_list_title + " Window"
    win_create_list.show()

    # ========== Window Image View ==========
    class StartWindowImageView(View):
        def draw(self, c, r):
            c.backcolor = view_backcolor
            c.erase_rect(r)

    view = StartWindowImageView(size=win_create_list.size)

    # ========== Title ==========
    title = Label(text=create_list_title)
    title.font = title_font
    title.width = title_width
    title.height = title_height
    title.x = (win_create_list.width - title_width) / 2
    title.y = top_border
    title.color = title_color
    title.just = 'center'

    # ========== Message Label ==========
    message = Label(font=title_font_3, width=win_create_list.width - 50, height=title_height,
                    x=25, y=title.bottom + top_border, color=title_color, just='center')
    message.text = message_text

    # ========== Button Declarations ==========
    enter_btn = Button("Enter")
    undo_btn = Button("Undo Add")
    back_btn = Button("Back")

    player_list_btn = Button("Player")
    formation_list_btn = Button("Formation")
    team_list_btn = Button("Team")

    # ========== Results Navigation Item Declarations ==========
    previous_btn = Button("<<< Previous %d" % num_results)
    next_btn = Button("Next %d >>>" % num_results)
    total_num_results_label = Label()
    pages_label = Label()

    # ========== Button Functions ==========
    def enter_btn_func():
        # Get file name and save
        if create_list_settings['process_step'] == 'file name':

            # Get file name and file prefix
            file_name = value_tf.value
            file_prefix = get_file_prefix('current_' + create_list_settings['list_type'] + '_list')

            if len(file_name) > 0:

                if not isfile('JSONs/' + file_prefix + file_name + '.json'):

                    # Create list object, set message, and set process step
                    if create_list_settings['list_type'] == 'player':
                        new_list = PlayerDB()
                        message.text = "Enter player rating/name or just name."
                        create_list_settings['process_step'] = 'get player'

                    elif create_list_settings['list_type'] == 'formation':
                        new_list = FormationDB()
                        message.text = "Enter part or full formation name, or nothing for full list."
                        create_list_settings['process_step'] = 'get formation'

                    elif create_list_settings['list_type'] == 'team':
                        new_list = TeamDB()
                        message.text = "Blank team list created. Add teams from Search menu."
                        create_list_settings['process_step'] = 'get team'
                        back_btn.title = "Done"
                        enter_btn.enabled = 0

                    else:
                        new_list = PlayerDB()
                        print "Invalid list type."

                    # Assign file name and file object
                    create_list_settings['list'] = new_list
                    create_list_settings['file_name'] = file_name

                    # Clear box content
                    value_tf.value = ''

                else:
                    message.text = "A file with that name already exists."
#.........这里部分代码省略.........
开发者ID:mcspen,项目名称:FIFA,代码行数:103,代码来源:CreateList.py

示例15: open_teams_menu

# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import resizable [as 别名]
def open_teams_menu(window_x, window_y, db_dict):

    # ========== Window ==========
    win_teams = Window()
    win_teams.title = teams_win_title
    win_teams.auto_position = False
    win_teams.position = (window_x, window_y)
    win_teams.size = (win_width, win_height)
    win_teams.resizable = 0
    win_teams.name = teams_title + " Window"

    # ========== Window Image View ==========
    class FormationsWindowImageView(View):
        def draw(self, c, r):
            c.backcolor = view_backcolor
            c.erase_rect(r)

    view = FormationsWindowImageView(size=win_teams.size)

    # ========== Title ==========
    title = Label(text=teams_title)
    title.font = title_font
    title.width = title_width
    title.height = title_height
    title.x = (win_width - title_width) / 2
    title.y = top_border
    title.color = title_color
    title.just = 'center'

    # ========== Button Declarations ==========
    create_ultimate_teams_btn = Button("Generate Ultimate Teams")
    manually_create_teams_btn = Button("Build Ultimate Teams")
    back_btn = Button("Back")

    # ========== Button Functions ==========
    def create_ultimate_teams_btn_func():
        win_teams.become_target()
        CreateUltimateTeams.open_create_ultimate_teams_window(win_teams.x, win_teams.y, db_dict, win_teams)
        win_teams.hide()

    def manually_create_teams_btn_func():
        win_teams.become_target()
        PickFormation.open_pick_formation_window(win_teams.x, win_teams.y, db_dict, win_teams)
        win_teams.hide()

    def back_btn_func():
        win_teams.become_target()
        StartMenu.open_start_menu(win_teams.x, win_teams.y, db_dict)
        win_teams.hide()

    # ========== Buttons ==========
    create_ultimate_teams_btn.x = (win_width - file_btn_width) / 2
    create_ultimate_teams_btn.y = title.bottom + top_border
    create_ultimate_teams_btn.height = button_height
    create_ultimate_teams_btn.width = file_btn_width
    create_ultimate_teams_btn.font = button_font
    create_ultimate_teams_btn.action = create_ultimate_teams_btn_func
    create_ultimate_teams_btn.style = 'default'
    create_ultimate_teams_btn.color = button_color
    create_ultimate_teams_btn.just = 'right'

    manually_create_teams_btn.x = (win_width - file_btn_width) / 2
    manually_create_teams_btn.y = create_ultimate_teams_btn.bottom + top_border
    manually_create_teams_btn.height = button_height
    manually_create_teams_btn.width = file_btn_width
    manually_create_teams_btn.font = button_font
    manually_create_teams_btn.action = manually_create_teams_btn_func
    manually_create_teams_btn.style = 'default'
    manually_create_teams_btn.color = button_color
    manually_create_teams_btn.just = 'right'

    back_btn.x = (win_width - button_width) / 2
    back_btn.y = manually_create_teams_btn.bottom + top_border*2
    back_btn.height = button_height
    back_btn.width = button_width
    back_btn.font = button_font
    back_btn.action = back_btn_func
    back_btn.style = 'default'
    back_btn.color = button_color
    back_btn.just = 'right'

    # ========== Add components to view and add view to window ==========
    view.add(title)
    view.add(create_ultimate_teams_btn)
    view.add(manually_create_teams_btn)
    view.add(back_btn)

    win_teams.add(view)
    view.become_target()
    win_teams.show()
开发者ID:mcspen,项目名称:FIFA,代码行数:92,代码来源:TeamsMenu.py


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