From 8a3d9753e6d493fc3421aaa4b38fef7c926588b1 Mon Sep 17 00:00:00 2001 From: anuragjain0610 Date: Tue, 1 Oct 2019 18:19:15 +0530 Subject: [PATCH] added docstrings to different functions --- gui_main.py | 5 +++++ gui_support.py | 2 ++ lib/plotutil.py | 16 ++++++++++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/gui_main.py b/gui_main.py index 046ba43..fa3603d 100644 --- a/gui_main.py +++ b/gui_main.py @@ -390,6 +390,9 @@ def popupInputHandler(self): def Dropdown_Changed(self, current_color): + """To change the color of drop-down menu + current_color: current color + """ color = '#000000' if current_color == 'Red': color = '#FF0000' @@ -405,6 +408,7 @@ def Dropdown_Changed(self, current_color): self.color_input.insert(0, color) def changeTheme(self): + """To change the background theme""" if self.bt_themeswitch['text'] == "Light Theme": self.bt_themeswitch.configure(text="Dark Theme") self.Canvas1.configure(background=_bgcolorlight) @@ -519,6 +523,7 @@ def changeTheme(self): self.rePlot(self.radiovar.get()) def resize_plot(self, event): + """To resize the Plot""" if gui_support.plotted: gui_support.Plot(self.fx.get(), range(int(self.x_lower.get()), int(self.x_upper.get())), self.color_input.get(), diff --git a/gui_support.py b/gui_support.py index 93a24d5..75e5b47 100644 --- a/gui_support.py +++ b/gui_support.py @@ -61,6 +61,7 @@ def Plot_line(arrays, color_name, theme, canvas, line_style, file_path): def init(top, gui, *args, **kwargs): + """To initiate the GUI window""" global w, top_level, root w = gui top_level = top @@ -68,6 +69,7 @@ def init(top, gui, *args, **kwargs): def destroy_window(): + """To close or destroy the current window""" # Function which closes the window. global top_level top_level.destroy() diff --git a/lib/plotutil.py b/lib/plotutil.py index c16b5d9..78f12c9 100644 --- a/lib/plotutil.py +++ b/lib/plotutil.py @@ -8,7 +8,7 @@ def create_y_values(func, xvals): - + """This function will create the ordinate values for the given function that is to be plotted""" # Create function ordinate values yvals = [] for x in xvals: @@ -21,7 +21,19 @@ def create_y_values(func, xvals): return yvals def plot(func, xpoints, color_name, xlabel, ylabel, theme, gui, line_style, file_path, discrete=False): - + """This function will show the summary of the plotted function + func: function plotted + xpoints: points on x-axix + color_name: color of the plot + xlabel: label on x-axis + ylabel: label on y-axis + theme: background theme + gui: show in gui (true or false) + line_style: line style of plotted graph + file_path: path for saving the graph + discrete: discrete points )true or false) + (false by default) + """ # Show plot summary print('***** Plot Summary *****') print("Funtion: {}".format(func))