So I was debugging some of my code today and noticed a new message in the output:
can't invoke "event" command: application has been destroyed
while executing
"event generate $w <<ThemeChanged>>"
(procedure "ttk::ThemeChanged" line 6)
invoked from within
"ttk::ThemeChanged"
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.
Chunk of code that outputs this:
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() # <--- This is where the problem is
label.destroy()
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 label.destroy()
would still give this error, but placing one anywhere before and stepping over to label.destroy()
would not print this, leading me to believe it was some type of timing error with self.update()
, but when I placed time.sleep(5)
before and after self.update()
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!
Beginning of code:
# !/usr/bin/python
# coding: utf-8
'''
Created on Jun 23, 2017
@author: jacob <---------------- 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
update_idletasks()
? – Sauerstk.Label
is a ttk widget. And as mentioned it isn't label.destroy, as this error happens before label.destroy is executed. – Huguenottk.Label
should be a tkinter widget not a ttk widget. The only waytk.Label
is a ttk widget is if you imported ttk as tk, and that would not be a good idea. – Saltigrade