code: def prompt_gui(path):
      
  
      import subprocess
  
      filepath, extension = os.path.splitext(path)
      basename = os.path.basename(filepath)
      dirname = os.path.dirname(filepath)
  
      retry_text = 'Sorry, please try again...'
      icon = 'video-x-generic'
  
      # detect and configure dialog program
      if have('yad'):
          args = ['yad',
                  '--borders=5',
                  '--entry',
                  '--entry-label=Filename:',
                  '--entry-text=' + basename,
                  '--title=Batch Tool',
                  '--window-icon=' + icon]
          retry_args = args + ['--text=<b>' + retry_text + '</b>',
                               '--text-align=center']
  
      elif have('zenity'):
          base = ['zenity',
                  '--entry',
                  '--entry-text=' + basename,
                  '--title=Batch Tool',
                  '--window-icon=info']
          args = base + ['--text=Filename:']
          retry_args = base + ['--text=' + retry_text]
  
      else:
          fatal('Please install yad (or zenity)')
  
      # display filename prompt
      try:
          new_basename = subprocess.check_output(
              args, universal_newlines=True).strip()
      except subprocess.CalledProcessError:
          sys.exit(1)
  
      # retry prompt if new filename already exists
      while os.path.exists(os.path.join(dirname, new_basename + extension)) and \
              new_basename != basename:
          try:
              new_basename = subprocess.check_output(
                  retry_args, universal_newlines=True).strip()
          except subprocess.CalledProcessError:
              sys.exit(1)
  
      if new_basename == '':
          new_basename = basename
  
      return os.path.join(dirname, new_basename + extension)
docs: Prompt for a new filename via GUI.