title: can't invoke "event" command: application has been destroyed
body: <p>So I was debugging some of my code today and noticed a new message in the output:</p>
  
  <pre><code>can't invoke "event" command:  application has been destroyed
       while executing
  "event generate $w &lt;&lt;ThemeChanged&gt;&gt;"
       (procedure "ttk::ThemeChanged" line 6)
      invoked from within
  "ttk::ThemeChanged"
  </code></pre>
  
  <p>I looked at the questions regarding it on SO but they did't relate to this instance of the error. As for the ttk widget, I have not used ttk once in my code, a search for the string "ttk" in my code yields none. </p>
  
  <p><em>Chunk of code that outputs this:</em></p>
  
  <pre><code>def GoToEvent(self, controller, driver):
  
      wait = WebDriverWait(driver, 600)
  
      var = Vars()
      entertain = var.GetVars("Link")
      if type(entertain) == type(""):
          event = var.GetVars("Event")
          entertain = driver.find_element_by_partial_link_text(event)
      entertain.click()
      try:
          # we have to wait for the page to refresh, the last thing that seems to be updated is the title
          wait.until(EC.title_contains("Entertain"))
      finally:
          # the page is ajaxy so the title is originally this:
          msg = driver.title
          label = tk.Label(self, text=msg, cursor='spinning', font="courier 24", bg="#c63f17")
          label.place(x=self.winfo_width()/2, y=self.winfo_height()/2, anchor="center")
          self.update()   # &lt;--- This is where the problem is
          label.destroy()
  </code></pre>
  
  <p>This doesn't seem to actually throw any errors, and my code runs absolutely fine. I can't give enough code to replocate the problem as it is just simply too much code before this, but I can tell you all the testing I did if that helps. I debugged this code block and found that adding a breakpoint at <code>label.destroy()</code> would still give this error, but placing one anywhere before and stepping over to <code>label.destroy()</code> would not print this, leading me to believe it was some type of timing error with <code>self.update()</code>, but when I placed <code>time.sleep(5)</code> before and after <code>self.update()</code> the error was still there. So stepping through the code did not show the error but time.sleep() still showed the error. This puzzles me, I don't know why it would be behaving this way, I have been writing this program for 2 weeks and this is the first time this has happened. If no one knows it's fine, the code still runs perfectly, I'm just curious as to what this means and why it is happening. Thanks!</p>
  
  <p><strong>Beginning of code:</strong></p>
  
  <pre><code># !/usr/bin/python
  # coding: utf-8
  '''
  Created on Jun 23, 2017
  
  @author: jacob    &lt;---------------- Line 6
  
  '''
  
  
  from selenium import webdriver
  #from selenium.common.exceptions import TimeoutException
  from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
  from selenium.webdriver.support import expected_conditions as EC # available since 2.26.0
  from selenium.webdriver.common.by import By
  from selenium.common.exceptions import NoSuchElementException
  import os
  import platform
  import pwd
  import re
  import time
  #import datetime
  from time import strftime
  import Tkinter as tk     
  import tkFont as tkfont  
  from Tkinter import Entry, Menu, Menubutton, Canvas
  </code></pre>