code: def test_toggle_colorize_event(self):
      color = self.color
      eq = self.assertEqual
  
      # Starts with colorizing allowed and scheduled.
      self.assertFalse(color.colorizing)
      self.assertFalse(color.stop_colorizing)
      self.assertTrue(color.allow_colorizing)
      eq(self.root.tk.call("after", "info", color.after_id)[1], "timer")
  
      # Toggle colorizing off.
      color.toggle_colorize_event()
      self.assertIsNone(color.after_id)
      self.assertFalse(color.colorizing)
      self.assertFalse(color.stop_colorizing)
      self.assertFalse(color.allow_colorizing)
  
      # Toggle on while colorizing in progress (doesn't add timer).
      color.colorizing = True
      color.toggle_colorize_event()
      self.assertIsNone(color.after_id)
      self.assertTrue(color.colorizing)
      self.assertFalse(color.stop_colorizing)
      self.assertTrue(color.allow_colorizing)
  
      # Toggle off while colorizing in progress.
      color.toggle_colorize_event()
      self.assertIsNone(color.after_id)
      self.assertTrue(color.colorizing)
      self.assertTrue(color.stop_colorizing)
      self.assertFalse(color.allow_colorizing)
  
      # Toggle on while colorizing not in progress.
      color.colorizing = False
      color.toggle_colorize_event()
      eq(self.root.tk.call("after", "info", color.after_id)[1], "timer")
      self.assertFalse(color.colorizing)
      self.assertTrue(color.stop_colorizing)
      self.assertTrue(color.allow_colorizing)
  
imports: from idlelib import colorizer
  from test.support import requires
  import unittest
  from unittest import mock
  from idlelib.idle_test.tkinter_testing_utils import run_in_tk_mainloop
  from functools import partial
  import textwrap
  from tkinter import Tk, Text
  from idlelib import config
  from idlelib.percolator import Percolator
label_desc: Use image node_id 11 for calling the ColorDelegatorTest obj's underlying member method code with example usage: obj.test_toggle_colorize_event() without return types