app/compare_page.py
def view_statistic_graph(self):
        """Show daiagram representing dependency of
        fighter's age and amount of fights that he has fought."""

        ######### check if any fighter has been selected
        first_fighter = self.first_fighter_choose_entry.get().strip()
        second_fighter = self.second_fighter_choose_entry.get().strip()

        if not all([first_fighter, second_fighter]):
            messagebox.showerror(
                title="Graph",
                message="You have to choose 2 fighters in order to do that!"
            )
            return

        ######### get their names from db & grab their stats
        first_fighter_in_db = f"{first_fighter.split()[0]} {first_fighter.split()[1]}"
        second_fighter_in_db = f"{second_fighter.split()[0]} {second_fighter.split()[1]}"

        for fighter in DatabaseManager().return_fighter_names():

            if first_fighter_in_db in fighter[0]:
                first_fighter_in_db = fighter[0]
            if second_fighter_in_db in fighter[0]:
                second_fighter_in_db = fighter[0]

        first_fighter_stats = DatabaseManager(
            ).return_fighter_stats_for_comparing_graph(
            fighter_name=first_fighter_in_db
        )
        second_fighter_stats = DatabaseManager(
            ).return_fighter_stats_for_comparing_graph(
            fighter_name=second_fighter_in_db
        )

        ######### create and adjust graph
        style_based_on_actual_theme = utilities.colors_dict(
            theme=self.themes_list.get(), file='COMPARE_PAGE')['graph']
        plt.style.use(style_based_on_actual_theme)
        plt.figure(figsize=(10, 5))

        x_indexes = np.arange(len(constants.GRAPH_X_VALUES))
        bar_width = 0.3

        plt.bar(
            x_indexes - bar_width/2,
            first_fighter_stats,
            width=bar_width,
            label=first_fighter_in_db
        )
        plt.bar(
            x_indexes + bar_width/2,
            second_fighter_stats,
            width=bar_width,
            label=second_fighter_in_db
        )
        plt.title(
            label=f"Warrior Fights Comparison",
            y=1.04, font='Arial', fontsize='20', fontweight='bold',
        )
        plt.xticks(ticks=x_indexes, labels=constants.GRAPH_X_VALUES)
        plt.xlabel("Fight Results", fontsize=15, labelpad=8)
        plt.ylabel("Amount Of Fights", fontsize=15, labelpad=10)
        plt.tick_params(labelsize=10)
        plt.legend()
        plt.grid()
        plt.tight_layout()
        plt.show()
Show daiagram representing dependency of
        fighter's age and amount of fights that he has fought.
Show daiagram representing dependency of
fighter's age and amount of fights that he has fought.
Show daiagram representing dependency of fighter ' s age and amount of fights that he has fought .
def view_statistic_graph(self):
        first_fighter = self.first_fighter_choose_entry.get().strip()
        second_fighter = self.second_fighter_choose_entry.get().strip()
        if not all([first_fighter, second_fighter]):
            messagebox.showerror(
                title="Graph",
                message="You have to choose 2 fighters in order to do that!"
            )
            return
        first_fighter_in_db = f"{first_fighter.split()[0]} {first_fighter.split()[1]}"
        second_fighter_in_db = f"{second_fighter.split()[0]} {second_fighter.split()[1]}"
        for fighter in DatabaseManager().return_fighter_names():
            if first_fighter_in_db in fighter[0]:
                first_fighter_in_db = fighter[0]
            if second_fighter_in_db in fighter[0]:
                second_fighter_in_db = fighter[0]
        first_fighter_stats = DatabaseManager(
            ).return_fighter_stats_for_comparing_graph(
            fighter_name=first_fighter_in_db
        )
        second_fighter_stats = DatabaseManager(
            ).return_fighter_stats_for_comparing_graph(
            fighter_name=second_fighter_in_db
        )
        style_based_on_actual_theme = utilities.colors_dict(
            theme=self.themes_list.get(), file='COMPARE_PAGE')['graph']
        plt.style.use(style_based_on_actual_theme)
        plt.figure(figsize=(10, 5))
        x_indexes = np.arange(len(constants.GRAPH_X_VALUES))
        bar_width = 0.3
        plt.bar(
            x_indexes - bar_width/2,
            first_fighter_stats,
            width=bar_width,
            label=first_fighter_in_db
        )
        plt.bar(
            x_indexes + bar_width/2,
            second_fighter_stats,
            width=bar_width,
            label=second_fighter_in_db
        )
        plt.title(
            label=f"Warrior Fights Comparison",
            y=1.04, font='Arial', fontsize='20', fontweight='bold',
        )
        plt.xticks(ticks=x_indexes, labels=constants.GRAPH_X_VALUES)
        plt.xlabel("Fight Results", fontsize=15, labelpad=8)
        plt.ylabel("Amount Of Fights", fontsize=15, labelpad=10)
        plt.tick_params(labelsize=10)
        plt.legend()
        plt.grid()
        plt.tight_layout()
        plt.show()
def view_statistic_graph ( self ) : first_fighter = self . first_fighter_choose_entry . get ( ) . strip ( ) second_fighter = self . second_fighter_choose_entry . get ( ) . strip ( ) if not all ( [ first_fighter , second_fighter ] ) : messagebox . showerror ( title = "Graph" , message = "You have to choose 2 fighters in order to do that!" ) return first_fighter_in_db = f"{first_fighter.split()[0]} {first_fighter.split()[1]}" second_fighter_in_db = f"{second_fighter.split()[0]} {second_fighter.split()[1]}" for fighter in DatabaseManager ( ) . return_fighter_names ( ) : if first_fighter_in_db in fighter [ 0 ] : first_fighter_in_db = fighter [ 0 ] if second_fighter_in_db in fighter [ 0 ] : second_fighter_in_db = fighter [ 0 ] first_fighter_stats = DatabaseManager ( ) . return_fighter_stats_for_comparing_graph ( fighter_name = first_fighter_in_db ) second_fighter_stats = DatabaseManager ( ) . return_fighter_stats_for_comparing_graph ( fighter_name = second_fighter_in_db ) style_based_on_actual_theme = utilities . colors_dict ( theme = self . themes_list . get ( ) , file = 'COMPARE_PAGE' ) [ 'graph' ] plt . style . use ( style_based_on_actual_theme ) plt . figure ( figsize = ( 10 , 5 ) ) x_indexes = np . arange ( len ( constants . GRAPH_X_VALUES ) ) bar_width = 0.3 plt . bar ( x_indexes - bar_width / 2 , first_fighter_stats , width = bar_width , label = first_fighter_in_db ) plt . bar ( x_indexes + bar_width / 2 , second_fighter_stats , width = bar_width , label = second_fighter_in_db ) plt . title ( label = f"Warrior Fights Comparison" , y = 1.04 , font = 'Arial' , fontsize = '20' , fontweight = 'bold' , ) plt . xticks ( ticks = x_indexes , labels = constants . GRAPH_X_VALUES ) plt . xlabel ( "Fight Results" , fontsize = 15 , labelpad = 8 ) plt . ylabel ( "Amount Of Fights" , fontsize = 15 , labelpad = 10 ) plt . tick_params ( labelsize = 10 ) plt . legend ( ) plt . grid ( ) plt . tight_layout ( ) plt . show ( )
Show daiagram representing dependency of
fighter's age and amount of fights that he has fought.
Show daiagram representing dependency of fighter ' s age and amount of fights that he has fought .
"""Show daiagram representing dependency of
        fighter's age and amount of fights that he has fought.""" ######### check if any fighter has been selected ######### get their names from db & grab their stats ######### create and adjust graph
self