  
          Parameters
          ----------
          args: tuple
              Tuple containing either the key press event (Ctrl+s shortcut) or the tk variable
              arguments (save button press)
          """
          if not self._save_var.get() and not isinstance(args[0], tk.Event):
              return
  
          root_path = os.path.join(os.path.realpath(os.path.dirname(sys.argv[0])))
 
</s> remove         if not self._save_var.get() and not isinstance(args[0], tk.Event):
 </s> add         if self._is_standalone and not self._save_var.get() and not isinstance(args[0], tk.Event): </s> remove         root_path = os.path.join(os.path.realpath(os.path.dirname(sys.argv[0])))
 </s> add         if self._is_standalone:
            root_path = os.path.join(os.path.realpath(os.path.dirname(sys.argv[0])))
        else:
            root_path = args[0]
 </s> remove         for preview in self.subnotebook.children.values():
            preview.save_preview(location)


class PreviewTrainCanvas(ttk.Frame):  # pylint: disable=too-many-ancestors
    """ Canvas to hold a training preview image

    Parameters
    ----------
    parent: :class:`tkinter.ttk.Notebook`
        The notebook that the training image canvas belongs to
    previewname: str
        The name of the preview image displayed in the canvas
    """
    def __init__(self, parent: ttk.Notebook, previewname: str) -> None:
        logger.debug("Initializing %s: (previewname: '%s')", self.__class__.__name__, previewname)
        ttk.Frame.__init__(self, parent)

        self.name = previewname
        get_images().resize_image(self.name, None)
        self.previewimage = get_images().previewtrain[self.name][1]

        self.canvas = tk.Canvas(self, bd=0, highlightthickness=0)
        self.canvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
        self.imgcanvas = self.canvas.create_image(0,
                                                  0,
                                                  image=self.previewimage,
                                                  anchor=tk.NW)
        self.bind("<Configure>", self.resize)
        logger.debug("Initialized %s:", self.__class__.__name__)

    def resize(self, event: tk.Event) -> None:
        """  Resize the image to fit the frame, maintaining aspect ratio
 </s> add 
            Tuple containing either the key press event (Ctrl+s shortcut), the tk variable
            arguments (standalone save button press) or the folder location (GUI save button press)
  
          Parameters
          ----------
          args: tuple
            Tuple containing either the key press event (Ctrl+s shortcut), the tk variable
            arguments (standalone save button press) or the folder location (GUI save button press)
            Tuple containing either the key press event (Ctrl+s shortcut), the tk variable
            arguments (standalone save button press) or the folder location (GUI save button press)
          """
          if not self._save_var.get() and not isinstance(args[0], tk.Event):
              return
  
          root_path = os.path.join(os.path.realpath(os.path.dirname(sys.argv[0])))
keep keep keep keep replace replace keep keep keep keep keep
 GUI - Preview updates
  - Training preview. Embed preview pop-out window
  - Bugfix - convert/extract previews 
lib/training/preview_tk.py