appJar
appJar copied to clipboard
KeyError: 33 when destroying subwindow
Bug Report
KeyError: 33 when destroying subwindow
Context
I want to destroy a subwindow when clicking on a button.
Expected Behaviour
the subwindow should close
Actual Behaviour
the subwindow does sometimes close but it raises an error
Any error messages produced by appJar
2020-05-03 13:45:15,277 appJar:WARNING [Line 381->5802/cleanseWidgets]: Unable to destroy Label, during cleanse - NO APPJAR TYPE
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python3.7/tkinter/__init__.py", line 1705, in __call__
return self.func(*args)
File "/home/marius/PycharmProjects/pyautogui-test/venv/lib/python3.7/site-packages/appJar/appjar.py", line 3783, in <lambda>
return lambda *args: funcName(param)
File "/home/marius/PycharmProjects/pyautogui-test/main.py", line 381, in img_grab_select
app.destroyAllSubWindows() # workaround
File "/home/marius/PycharmProjects/pyautogui-test/venv/lib/python3.7/site-packages/appJar/appjar.py", line 5754, in destroyAllSubWindows
self.cleanseWidgets(wi)
File "/home/marius/PycharmProjects/pyautogui-test/venv/lib/python3.7/site-packages/appJar/appjar.py", line 5794, in cleanseWidgets
self.widgetManager.destroyContainer(WIDGET_NAMES.ContainerLog, widget)
File "/home/marius/PycharmProjects/pyautogui-test/venv/lib/python3.7/site-packages/appJar/appjar.py", line 15907, in destroyContainer
widgets = self.widgets[widgType]
KeyError: 33
Sample code, demonstrating the issue
def done_grabbing(urls):
app.setLabel("currentAction", "") # accessing the "normal" window here
app.setLabel("currentActionSub", "")
print(urls)
app.startSubWindow("imgGrabSelect", "Select Image to use", modal=True, blocking=True)
app.setBg("white")
app.setOnTop(stay=True)
app.setSize(1000, 800)
app.addLabel("selImgLbl", "Select Image to use", row=0)
…
app.addImageData(url, app_jar_image, fmt="PhotoImage", row=row, column=col)
app.setImageSubmitFunction(url, img_grab_select) # error occurs here, when clicking the img
app.showSubWindow("imgGrabSelect")
…
def img_grab_select(url):
…
app.setLabel("img", "Selected Image: " + ("Yes" if did_select_img else "No") + ". Using grabbed image.") # setting a label on the outer "normal" window here
app.destroySubWindow("imgGrabSelect") # error occurs here
What steps are needed to reproduce the bug
The code I provided should already show the error. If you want, you can run my program (just one File): https://gist.github.com/8a3c3df95e039f4ae15e44f5b857dd25
You need a chromium selenium webdriver, set the path to the driver using the variable DRIVER_PATH at the top of the file. Start the program, Click on "Grab Image", enter a search term (e.g. Dogs), wait until downloaded, click on one of the available images in the subwindow that opens and look in the log.
Version Information
appJar==0.94.0
I am having the same issue.