DigiDan last edited by
I have a webview that calls
I ensure that this is called on a background thread using the
I am experiencing freezes when the alert is displayed where I can't press any buttons or enter any text in the alert and I can't exit the Python app using the little cross in the top left.
JonB last edited by
This issue seems be caused when the ui thread is trying to do some animation or drawing while console.alert is presented. In this case, webview is probably finishing rendering while the alert is trying to pop up, not sure. .
The workaround is to ui.delay your alert for a small time, 0.5 has been pretty safe, but maybe as low as 0.25, depending on what was being done. if you have an actual animation pending, need to wait for animation to complete. Also, make sure you don't have any pending delays that could try to do anything to change the ui state.
def webview_did_finish_load(self,webview): @ui.in_background def alert(): console.alert('test') ui.delay(alert,0.5) # give enougn time for webview to finish drawing #ui.delay(webview.superview.close,5.0) an example of what NOT TO DO.. this will crash if alert is still open after 5 sec
I will point out that
hud_alertis much nicer if you just want to display a message that says the page loaded. This doesn't need to be backgrounded or delayed, and you don't have to handle the keyboardinterrupt that alert raises, etc. only use
alertif you want actual interaction with the user.