text: import time
  from os import system, walk
  from config import CONFIG
  from encry import ENCRY
  from decry import DECRY
  
  
  # Функция настройки конфигурации
  def conf_setting():
      system('CLS')
      print("Enter key elements: ")
      # Выбор алфавита
      alphabet = input("Select the used alphabet [EN]GLISH | [RU]SSIAN: ")
      # Ввод числового ключа
      numberKey = input("Enter a numeric key: ")
      # Ввод ключевого слова
      stringKey = input("Enter your keyword: ")
      return CONFIG(alphabet, numberKey, stringKey)
  
  
  def en_message():
      print("Encryption")
  
  
  def de_message():
      print("Decryption")
  
  
  def select_file():
      # Создаем список всех .txt файлов
      filelist = []
      for root, dirs, files in walk("."):
          for file in files:
              if file.endswith(".txt"):
                  # Добавляем в список
                  filelist.append(file)
  
      s = ''
      while True:
          system('CLS')
          print("List of txt files: ")
          for i in filelist:
              print(i)
  
          file = input("Select a file: ")
          try:
              f = open(file, 'r', encoding='utf-8')
              s = f.read()
              f.close()
              break
          except Exception:
              print("Error: file not found")
  
      return s
  
  
  # Вывод меню
  def print_menu(cryptMode, CONF, text):
      file_text = text
  
      while cryptMode != 'EXIT':
          system('CLS')
          # Выбор действия
          cryptMode = input("[E]ncryption|[D]ecryption| [Select] file |[S]etting configure |[Show] configuration |[Show text] |[Exit]: ").upper()
          # Если команды не существует
          if cryptMode not in ['E', 'D', 'S', 'EXIT', 'SHOW', 'SELECT', 'SHOW TEXT']:
              print("Error: command not find!")
              time.sleep(2)
  
          # Если выбрана настройка конфигурации
          if cryptMode == 'S':
              CONF = conf_setting()
  
          # Если выбран шифровка или дешифровка
          if cryptMode in ['E', 'D']:
              # Проверка на то, что файл выбран и проведены настройки конфигурации
              if CONF is not object:
                  try:
                      if cryptMode == 'E':
                          print("Encryption in progress please wait...")
                          en_text = ENCRY(CONF.alphaList, CONF.new_alphaList, file_text.upper()).new_text()
                          print(file_text)
                          print(en_text)
  
                          try:
                              f = open("en_text.txt", 'w', encoding='utf-8')
                              f.write(en_text)
                              f.close()
                              print("Successfully. Encrypted file written! (en_text.txt)")
                              input("Please enter something to continue ...")
                          except Exception:
                              print("Error: file don't creat!")
                              input("Please enter something to continue ...")
  
                      if cryptMode == 'D':
                          print("Decryption in progress please wait...")
                          de_text = DECRY(CONF.alphaList, CONF.new_alphaList, file_text.upper()).new_text()
                          print(file_text)
                          print(de_text)
  
                          try:
                              f = open("de_text.txt", 'w', encoding='utf-8')
                              f.write(de_text)
                              f.close()
                              print("Successfully. Encrypted file written! (de_text.txt)")
                              input("Please enter something to continue ...")
                          except Exception:
                              print("Error: file don't creat!")
                              input("Please enter something to continue ...")
  
                  except Exception:
                      print(Exception)
                      time.sleep(2)
              else:
                  if CONF is object:
                      print("Customize the configuration!")
                      time.sleep(2)
                  if file_text == '':
                      print("Chose file!")
                      time.sleep(2)
                  print("Wait...")
                  time.sleep(2)
  
          # Если выбран выбор файла
          if cryptMode == 'SELECT':
              file_text = select_file()
  
          # Если выбран показать файлы конфигурации
          if cryptMode == 'SHOW':
              if CONF is not object:
                  CONF.print_conf()
                  input("Please enter something to continue ...")
              else:
                  print("Customize the configuration!")
                  time.sleep(2)
  
          # Если выбран показать текст
          if cryptMode == 'SHOW TEXT':
              if file_text != '':
                  print(file_text)
                  input("Please enter something to continue ...")
              else:
                  print("Please choose file!")
                  time.sleep(2)
  
  
  if __name__ == '__main__':
      CONF = object
      text = ''
      cryptMode = ''
      print_menu(cryptMode, CONF, text)
  