code: def __init__(self):
      self.__master = Tk()
      self.__master.title("Recognition")
  
      self.__widget = Canvas(self.__master, width=320, height=320)
      self.__widget.pack(expand=YES, fill=BOTH)
      self.__widget.bind("<B1-Motion>", self.__paint)
  
      button_recognize = Button(
          self.__master,
          text="Recognize",
          command=self.click_recognize,
          width=25,
      )
      button_recognize.pack(side=BOTTOM)
  
      button_recognize = Button(
          self.__master,
          text="Random Image",
          command=self.click_image_load,
          width=25,
      )
      button_recognize.pack(side=BOTTOM)
  
      #         button_save = Button(self.__master, text = "Save", command = self.click_save, width = 25);
      #         button_save.pack(side = BOTTOM);
      #
      #         button_load = Button(self.__master, text = "Load", command = self.click_load, width = 25);
      #         button_load.pack(side = BOTTOM);
  
      button_train = Button(
          self.__master,
          text="Train",
          command=self.click_train,
          width=25,
      )
      button_train.pack(side=BOTTOM)
  
      button_clean = Button(
          self.__master,
          text="Clean",
          command=self.click_clean,
          width=25,
      )
      button_clean.pack(side=BOTTOM)
  
      self.__user_pattern = [0 for i in range(32 * 32)]
      self.__recognizer = recognizer()
  
imports: from pyclustering.nnet.som import som, type_conn
  from pyclustering.samples.definitions import IMAGE_DIGIT_SAMPLES
  from pyclustering.utils import read_image, rgb2gray
  from tkinter import *
  from tkinter import messagebox
  import math
  import pickle
  import os
  import random
label_desc: Use image node_id 1 to create a new digit_application object  with example: obj = digit_application()