          """ Initialize a standalone tkinter instance. """
          logger.debug("Initializing tkinter")
          initialize_config(self, None, None, None)
          initialize_images()
          self._set_geometry()
          self.title("Faceswap.py - Convert Settings")
          self.tk.call(
              "wm",
              "iconphoto",
              self._w, get_images().icons["favicon"])  # pylint:disable=protected-access
 
</s> remove     def _get_scaling(self):
        """ Get dpi and update scaling for the display.

        Returns
        -------
        float: The scaling factor for display
        """
        dpi = self.winfo_fpixels("1i")
        scaling = dpi / 72.0
        logger.debug("dpi: %s, scaling: %s'", dpi, scaling)
        return scaling

    def _set_geometry(self):
        """ Set the GUI window geometry. """
        self.tk.call("tk", "scaling", self._scaling)
        width = int(940 * self._scaling)
        height = int(600 * self._scaling)
        logger.debug("Geometry: %sx%s", width, height)
        self.geometry("{}x{}+80+80".format(str(width), str(height)))

 </s> add  </s> remove     def set_geometry(self):
        """ Set GUI geometry """
        fullscreen = self._config.user_config_dict["fullscreen"]
        scaling_factor = self._config.scaling_factor

        if fullscreen:
            initial_dimensions = (self.winfo_screenwidth(), self.winfo_screenheight())
        else:
            initial_dimensions = (round(1200 * scaling_factor), round(640 * scaling_factor))

        if fullscreen and sys.platform == "win32":
            self.state('zoomed')
        elif fullscreen:
            self.attributes('-zoomed', True)
        else:
            self.geometry("{}x{}+80+80".format(str(initial_dimensions[0]),
                                               str(initial_dimensions[1])))
        logger.debug("Geometry: %sx%s", *initial_dimensions)

 </s> add  </s> remove         exit()
 </s> add         sys.exit(0) </s> remove         self.tree.delete(* self.tree.get_children())
        self.tree.configure(height=1)
 </s> add         try:
            self.tree.delete(* self.tree.get_children())
            self.tree.configure(height=1)
        except tk.TclError:
            # Catch non-existent tree view when rebuilding the GUI
            pass </s> remove     def __init__(self, parent, config_tools, patch_callback, scaling):
        logger.debug("Initializing %s: (parent: %s, config: %s, scaling: %s)",
                     self.__class__.__name__, parent, config_tools, scaling)
 </s> add     def __init__(self, parent, config_tools, patch_callback):
        logger.debug("Initializing %s: (parent: %s, config: %s)",
                     self.__class__.__name__, parent, config_tools)
        get_config().set_geometry(940, 600, fullscreen=False)
          """ Initialize a standalone tkinter instance. """
          logger.debug("Initializing tkinter")
          initialize_config(self, None, None, None)
          initialize_images()
        get_config().set_geometry(940, 600, fullscreen=False)
          self.title("Faceswap.py - Convert Settings")
          self.tk.call(
              "wm",
              "iconphoto",
              self._w, get_images().icons["favicon"])  # pylint:disable=protected-access
keep keep keep keep replace keep keep keep keep keep
 lib.gui
Centralize get_scaling and set_geometry to utils.config
Suppress Error when rebuilding GUI for TreeView 
tools/preview.py