code: def loop_tk(kernel):
      """Start a kernel with the Tk event loop."""
  
      try:
          from tkinter import Tk  # Py 3
      except ImportError:
          from Tkinter import Tk  # Py 2
      doi = kernel.do_one_iteration
      # Tk uses milliseconds
      poll_interval = int(1000 * kernel._poll_interval)
  
      # For Tkinter, we create a Tk object and call its withdraw method.
      class Timer(object):
          def __init__(self, func):
              self.app = Tk()
              self.app.withdraw()
              self.func = func
  
          def on_timer(self):
              self.func()
              self.app.after(poll_interval, self.on_timer)
  
          def start(self):
              self.on_timer()  # Call it once to get things going.
              self.app.mainloop()
  
      kernel.timer = Timer(doi)
      kernel.timer.start()
  
imports: import os
  import sys
  import platform
  import zmq
  from distutils.version import LooseVersion
  from traitlets.config.application import Application
  from IPython.utils import io
label_desc: Use image node_id 12 for calling a global function with example usage: loop_tk(kernel) without return types