Older stuff/Tests_alias_TKinter_gui.py
def make_sim_step(self):
        """
        Calculates some small amount of steps, before handing control to GUI
            for a while, which will call it again in a short moment.

        TODO: decide, how to handle parameters like dt and max_iter - whether
            to have them as inputs to the function, or instance variables
            - with the lambda function in after() it is possible to input
              parameters into the self-calling function

        OPINION: I would make them instance variables.
                 I do not see what would be appropriate to pass between calls like that.
                 If that changes I would use self.something...
        """

        # What to do at the very end of the simulation
        if self.Sim.t[-1] >= self.t_stop:
            self.run_button["bd"] = 2
            self.simulation_state = "finished"
            self.dt = None # Setting the value back to undefined, to be udpated the next run
            # Allowing to modify the inputs again
            for parameter in self.number_parameters_to_get_from_user:
                getattr(self, parameter["input_name"])["state"] = "normal"

            # Calculating and displaying the error value (average temperature error)
            ErrorNorm = np.sum(abs(self.Sim.T_x0 - self.T_experiment(self.Sim.t[1:])))/len(self.Sim.t[1:])
            self.display_error_value(ErrorNorm)

            # Saving the results to the CSV and PGN files
            self.save_results_to_csv_file(self.Sim.t[1:], self.Sim.T_x0,
                                        self.chosen_material, "NumericalForward")
            self.save_results_to_png_file(self.temperature_figure, self.Sim.T_x0[0],
                                        self.Sim.t[-1], self.chosen_material, "NumericalForward")

        iter = 0
        max_loop_iter = 30
        # enter the loop temporarily and hand the control back to the GUI afterwards
        while self.Sim.t[-1] < self.t_stop and iter <= max_loop_iter:
            dt = min(self.dt, self.t_stop-self.Sim.t[-1])  # checking if not surpassing t_stop
            EvaluateNewStep(self.Sim, dt, 0.5)  # evaluate Temperaures at step k
            self.MyCallBack.Call(self.Sim)
            iter += 1

        if self.simulation_state == "running":
            # https://stackoverflow.com/questions/29158220/tkinter-understanding-mainloop
            # Calls itself after 3ms (this might get it laggy if too low) so other stuff
            #   can happen in the app.mainloop in those 3ms
            self.after(1, self.make_sim_step)

        Calculates some small amount of steps, before handing control to GUI
            for a while, which will call it again in a short moment.

        TODO: decide, how to handle parameters like dt and max_iter - whether
            to have them as inputs to the function, or instance variables
            - with the lambda function in after() it is possible to input
              parameters into the self-calling function

        OPINION: I would make them instance variables.
                 I do not see what would be appropriate to pass between calls like that.
                 If that changes I would use self.something...
        
Calculates some small amount of steps, before handing control to GUI
for a while, which will call it again in a short moment.

decide, how to handle parameters like dt and max_iter - whether
to have them as inputs to the function, or instance variables
with the lambda function in after() it is possible to input
parameters into the self-calling function

I would make them instance variables.
I do not see what would be appropriate to pass between calls like that.
If that changes I would use self.something
Calculates some small amount of steps before handing control to GUI for a while which will call it again in a short moment . decide how to handle parameters like dt and max_iter - whether to have them as inputs to the function or instance variables with the lambda function in after () it is possible to input parameters into the self - calling function I would make them instance variables . I do not see what would be appropriate to pass between calls like that . If that changes I would use self . something
def make_sim_step(self):
        if self.Sim.t[-1] >= self.t_stop:
            self.run_button["bd"] = 2
            self.simulation_state = "finished"
            self.dt = None 
            for parameter in self.number_parameters_to_get_from_user:
                getattr(self, parameter["input_name"])["state"] = "normal"
            ErrorNorm = np.sum(abs(self.Sim.T_x0 - self.T_experiment(self.Sim.t[1:])))/len(self.Sim.t[1:])
            self.display_error_value(ErrorNorm)
            self.save_results_to_csv_file(self.Sim.t[1:], self.Sim.T_x0,
                                        self.chosen_material, "NumericalForward")
            self.save_results_to_png_file(self.temperature_figure, self.Sim.T_x0[0],
                                        self.Sim.t[-1], self.chosen_material, "NumericalForward")
        iter = 0
        max_loop_iter = 30
        while self.Sim.t[-1] < self.t_stop and iter <= max_loop_iter:
            dt = min(self.dt, self.t_stop-self.Sim.t[-1])  
            EvaluateNewStep(self.Sim, dt, 0.5)  
            self.MyCallBack.Call(self.Sim)
            iter += 1
        if self.simulation_state == "running":
            self.after(1, self.make_sim_step)
def make_sim_step ( self ) : if self . Sim . t [ - 1 ] >= self . t_stop : self . run_button [ "bd" ] = 2 self . simulation_state = "finished" self . dt = None for parameter in self . number_parameters_to_get_from_user : getattr ( self , parameter [ "input_name" ] ) [ "state" ] = "normal" ErrorNorm = np . sum ( abs ( self . Sim . T_x0 - self . T_experiment ( self . Sim . t [ 1 : ] ) ) ) / len ( self . Sim . t [ 1 : ] ) self . display_error_value ( ErrorNorm ) self . save_results_to_csv_file ( self . Sim . t [ 1 : ] , self . Sim . T_x0 , self . chosen_material , "NumericalForward" ) self . save_results_to_png_file ( self . temperature_figure , self . Sim . T_x0 [ 0 ] , self . Sim . t [ - 1 ] , self . chosen_material , "NumericalForward" ) iter = 0 max_loop_iter = 30 while self . Sim . t [ - 1 ] < self . t_stop and iter <= max_loop_iter : dt = min ( self . dt , self . t_stop - self . Sim . t [ - 1 ] ) EvaluateNewStep ( self . Sim , dt , 0.5 ) self . MyCallBack . Call ( self . Sim ) iter += 1 if self . simulation_state == "running" : self . after ( 1 , self . make_sim_step )
Calculates some small amount of steps, before handing control to GUI
for a while, which will call it again in a short moment.
Calculates some small amount of steps before handing control to GUI for a while which will call it again in a short moment .
"""
        Calculates some small amount of steps, before handing control to GUI
            for a while, which will call it again in a short moment.

        TODO: decide, how to handle parameters like dt and max_iter - whether
            to have them as inputs to the function, or instance variables
            - with the lambda function in after() it is possible to input
              parameters into the self-calling function

        OPINION: I would make them instance variables.
                 I do not see what would be appropriate to pass between calls like that.
                 If that changes I would use self.something...
        """ # What to do at the very end of the simulation # Setting the value back to undefined, to be udpated the next run # Allowing to modify the inputs again # Calculating and displaying the error value (average temperature error) # Saving the results to the CSV and PGN files # enter the loop temporarily and hand the control back to the GUI afterwards # checking if not surpassing t_stop # evaluate Temperaures at step k # https://stackoverflow.com/questions/29158220/tkinter-understanding-mainloop # Calls itself after 3ms (this might get it laggy if too low) so other stuff #   can happen in the app.mainloop in those 3ms
self