      ''' Main GUI Control '''
      def __init__ (self, subparser, subparsers, parser, command, description='default'):
      # Don't try to load the GUI if there is no display or there are problems importing tkinter
          cmd = sys.argv
          if not check_display(cmd) or not import_tkinter(cmd):
              return
         
          self.parser = parser
          self.opts = self.extract_options(subparsers)
          self.root = FaceswapGui(self.opts, self.parser)
 
</s> remove     ''' Main GUI Control '''
    def __init__ (self, subparser, subparsers, parser, command, description='default'):
    # Don't try to load the GUI if there is no display or there are problems importing tkinter
 </s> add     """ Main GUI Control """

    def __init__(self, subparser, subparsers, command, description='default'):
        # Don't try to load the GUI if there is no display or there are
        # problems importing tkinter </s> remove        
        self.parser = parser
 </s> add         self.arguments = None </s> remove             self.parser.set_defaults(func=self.bad_args)
            arguments = self.parser.parse_args()
            arguments.func(arguments)
        except:
            self.statustext.set('Failed: ' + command.title())    
            raise
        self.statustext.set('Idle')
        exit()        
 </s> add             self.process.terminate()
            self.process.wait(timeout=10)
            print('Terminated')
        except TimeoutExpired:
            print('Termination timed out. Killing Process...')
            self.process.kill()
            print('Killed')

    def set_final_status(self, returncode):
        """ Set the status bar output based on subprocess return code """
        if returncode == 0 or returncode == 3221225786:
            status = 'Ready'
        elif returncode == -15:
            status = 'Terminated - {}.py'.format(self.command)
        elif returncode == -9:
            status = 'Killed - {}.py'.format(self.command)
        elif returncode == -6:
            status = 'Aborted - {}.py'.format(self.command)
        else:
            status = 'Failed - {}.py. Return Code: {}'.format(self.command, returncode)
        self.utils.guitext['status'].set(status)
 </s> remove         self.root = FaceswapGui(self.opts, self.parser)
 </s> add         self.utils = Utils(self.opts, calling_file=cmd[0])
        self.root = FaceswapGui(self.utils, calling_file=cmd[0]) </s> remove class FaceswapGui(object):
    ''' The Graphical User Interface '''
    def __init__(self, options, parser):
        self.gui = tk.Tk()
 </s> add # An error will be thrown when importing tkinter for users without tkinter
# distribution packages or without an X-Console. Therefore if importing fails
# no attempt will be made to instantiate the gui.
try:
    import tkinter as tk
    from tkinter import ttk
    from tkinter import filedialog
    from tkinter import messagebox
    from tkinter import TclError
except ImportError:
    tk = None
    ttk = None
    filedialog = None
    messagebox = None
    TclError = None

class Utils(object):
    """ Inter-class object holding items that are required across classes """

    def __init__(self, options, calling_file="faceswap.py"):
        if not self.check_display(cmd) or not self.check_tkinter_available(cmd):
      ''' Main GUI Control '''
      def __init__ (self, subparser, subparsers, parser, command, description='default'):
      # Don't try to load the GUI if there is no display or there are problems importing tkinter
          cmd = sys.argv
        if not self.check_display(cmd) or not self.check_tkinter_available(cmd):
              return
         
          self.parser = parser
          self.opts = self.extract_options(subparsers)
          self.root = FaceswapGui(self.opts, self.parser)
keep keep keep keep replace keep keep keep keep keep
 GUI v0.2.1b (#352)

* Code refactor

* Console Added

* Add graphing with matplotlib

* Add GUI preview support

* Improve import handling.

* Add GUI integration for tools.py (Launch tools.py with the gui command)

* Reformat to conform to PEP8.

* Add Tooltips, 

* Make panels user adjustable

* Fix convert.py Sharpen default value 
scripts/gui.py