コード例 #1
0
class Application(tk.Frame):
    def __init__(self, master=None):
        tk.Frame.__init__(self, master)
        self.grid()
        self.create_widgets()

    def create_widgets(self):
        self.charts = Charts(self)
        self.charts.grid(row=0)

        self.sliders = Sliders(self)
        self.sliders.grid(row=1)

        self.quit_btn = tk.Button(self, text="OK", command=self.quit)
        self.quit_btn.grid(row=2, columnspan=2)

    def on_slider_value_changed(self, base, extra, accA, accB):
        total_exp_list = get_total_exp_list(from_=1,
                                            to_=99,
                                            base_value=base,
                                            extra_value=extra,
                                            acceleration_A=accA,
                                            acceleration_B=accB)
        exp_per_lvl_list = get_exp_for_next_level_list(from_=1,
                                                       to_=99,
                                                       base_value=base,
                                                       extra_value=extra,
                                                       acceleration_A=accA,
                                                       acceleration_B=accB)

        self.charts.on_slider_value_changed(total_exp_list, exp_per_lvl_list)
コード例 #2
0
    def create_widgets(self):
        self.charts = Charts(self)
        self.charts.grid(row=0)

        self.sliders = Sliders(self)
        self.sliders.grid(row=1)

        self.quit_btn = tk.Button(self, text="OK", command=self.quit)
        self.quit_btn.grid(row=2, columnspan=2)
コード例 #3
0
 def histogram_browsers_a(self):
     """
     Creates a histogram of visitors from different browsers but without formatting the browser name
     """
     # Get the occurrences of a browser in the form of a dictionary
     df_dictionary = self._count_occurrences(self.df["visitor_useragent"])
     # Plot the data
     Charts(df_dictionary, "No. of visitors by browsers (Verbose)",
            "Browsers", "Visitors").plot_histogram()
コード例 #4
0
 def histogram_browsers_b(self):
     """
     Creates a histogram of visitors from different browsers
     """
     # Filter the dataset for using only the browser column into a series.
     sorted_df = self.df["visitor_useragent"].str.split("/").str[0]
     # Get the occurrences of a browser in the form of a dictionary
     df_dictionary = self._count_occurrences(sorted_df)
     # Plot the data
     Charts(df_dictionary, "No. of visitors by browsers (Formatted)",
            "Browsers", "Visitors").plot_histogram()
コード例 #5
0
    def histogram_country(self, doc_id: str):
        """
        Creates a histogram of visitors from different countries for a given document UUID

        :param doc_id: The input document
        """
        # Filter data to get rows only where the value of doc_id in the column exists into a series object.
        sorted_df = self.df[self.df["subject_doc_id"] ==
                            doc_id].loc[:, ["visitor_country"]]
        # Get the number of occurrences for a country for the series object in the form of a dictionary
        df_dictionary = self._count_occurrences(sorted_df)
        # Plot the data
        Charts(df_dictionary, "No. of visitors by country", "Countries",
               "Visitors").plot_histogram()
コード例 #6
0
    def histogram_continent(self, doc_id: str):
        """
        Creates a histogram of visitors from different continents for a given document UUID.

        :param doc_id: The input document
        """
        # Filter data to get rows only where the value of doc_id in the column exists.
        sorted_df = self.df[self.df["subject_doc_id"] ==
                            doc_id].loc[:, ["visitor_country"]]
        # A series object that contains the continents for that country by mapping the country value
        # to the continent value
        sorted_df = sorted_df["visitor_country"].apply(
            lambda x: self.CONTINENTS_MAP.get(x))
        # Get the occurrences of a continents in the form of a dictionary
        df_dictionary = self._count_occurrences(sorted_df)
        # # Plot the data
        Charts(df_dictionary, "No. of visitors by continent", "Continents",
               "Visitors").plot_histogram()
コード例 #7
0
def display_page(pathname):
    if pathname == '/download':
        return Download()
    elif pathname == '/table':
        return Table()
    elif pathname == '/app':
        return App()
    elif pathname == '/apka':
        return Apka(r, t, df1)
    elif pathname == '/charts':
        return Charts(r, t, df1)
    elif pathname == '/calc':
        return Calc(r, t, df1)
    elif pathname == '/report':
        return Report(r, t, df1)
    elif pathname == '/send':
        return Send(r, t)
    else:
        return Home()